Oppure

Loading
18/02/12 13:10
puzz1998
ragazzi sto cercando di creare una chat privata tra amici utilizzando il no-ip. nel primo client l'ho connesso al no-ip e anche il sever . solo che il problema consinte nel mandate messaggi/comandi utilizzando il no-ip.ho usato il seguente codice:
Imports Microsoft.VisualBasic.ApplicationServices
Imports System.Windows.Forms.VisualStyles.VisualStyleElement

Public Class no_ip

    Private Property User As String

    Private Property pass As String

    Private Property ip As String

    Private Property l As Object

    Private Property Status As Object

    Private Property t As Object

    Private Sub no_ip_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load

    End Sub


    'routine for updating a No-IP service (www.no-ip.com)
    Function UpdateNoIP(UserName, Password, Hostname, actIP)
        Dim xmlhttp As Object
        Dim URL As String

        xmlhttp = CreateObject("microsoft.xmlhttp")
        URL = "http://dynupdate.no-ip.com/dns?username=" & UserName
        URL = URL & "&password=" & Password & "&hostname=" & Hostname
        If actIP <> "" Then URL = URL & "&ip=" & actIP

        xmlhttp.open("get", URL, False)
        xmlhttp.SetRequestHeader("Pragma", "no-cache")
        xmlhttp.SetRequestHeader("Cache-control", "no-cache")

        On Error Resume Next
        xmlhttp.Send()

        If Err.Number <> 0 Then
            UpdateNoIP = "Error!"
            Exit Function
        End If

        If xmlhttp.Status = 200 Then
            UpdateNoIP = CStr(xmlhttp.responseText)
        Else
            If xmlhttp.Status = 401 Then
                UpdateNoIP = "Authorization Error"
            Else
                UpdateNoIP = "Error"
            End If
        End If

        If InStr(UpdateNoIP, ":") Then
            Status = AfterLast(UpdateNoIP, ":")
            Status = BeforeLast(Status, Chr(10))
            Select Case Status
                Case 0 : UpdateNoIP = "Success - IP address is current, no update performed"
                Case 1 : UpdateNoIP = "Success - DNS hostname update successful"
                Case 2 : UpdateNoIP = "Error - Hostname supplied does not exist"
                Case 3 : UpdateNoIP = "Error - Invalid username"
                Case 4 : UpdateNoIP = "Error - Invalid password"

                Case 6 : UpdateNoIP = "Error - Account disabled due to violation of No-IP terms of service. Our terms of service can be viewed at http://www.no-ip.com/legal/tos"
                Case 7 : UpdateNoIP = "Error - Invalid IP. Invalid IP submitted is improperly formated, is a private LAN RFC 1918 address, or an abuse blacklisted address."
                Case 8 : UpdateNoIP = "Error - Disabled / Locked hostname"
                Case 9 : UpdateNoIP = "Host updated is configured as a web redirect and no update was performed."
                Case 10 : UpdateNoIP = "Error - Group supplied does not exist"
                Case 11 : UpdateNoIP = "Success - DNS group update is successful"
                Case 12 : UpdateNoIP = "Success - DNS group is current, no update performed."
                Case 13 : UpdateNoIP = "Error - Update client support not available for supplied hostname or group"
                Case 14 : UpdateNoIP = "Error - Hostname supplied does not have offline settings configured. Returned if sending offline=YES on a host that does not have any offline actions configured."
                Case 99 : UpdateNoIP = "Error - Client disabled. Client should exit and not perform any more updates without user intervention."
                Case 100 : UpdateNoIP = "Error - User input error usually returned if missing required request parameters"
            End Select
        End If
    End Function


    'public string functions
    Function AfterLast(sFrom, sAfterLast)
        If InStr(1, sFrom, sAfterLast) Then
            AfterLast = Right(sFrom, Len(sFrom) - InStrRev(sFrom, sAfterLast) - (Len(sAfterLast) - 1))
        Else
            AfterLast = ""
        End If
    End Function

    Function BeforeLast(sIn, sLast)
        t = AfterLast(sIn, sLast)
        l = Len(sIn) - Len(t) - Len(sLast)
        BeforeLast = Left(sIn, l)
    End Function

    Private Function host() As Object
        host = "xxx.no-ip.com"
    End Function

    Private Function Left(sIn As Object, p2 As Object) As Object
        Throw New NotImplementedException
    End Function

    Private Function Right(sFrom As Object, p2 As Integer) As Object
        Throw New NotImplementedException
    End Function

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        User = ""
        pass = ""
        ip = ""
        TextBox4.Text = UpdateNoIP(User, pass, host, ip)
    End Sub
End Class
aaa