Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21848

winsock connect friends home ip plz help

$
0
0
i have a vps i tested this on vps and it connects but when i try and connect to friends pc using his ip it dont connect please help


my client code


Quote:

Private Sub Command1_Click()
sckMain.Close 'Close sckMain First
sckMain.RemotePort = "1884" 'Set Port
sckMain.RemoteHost = Text1 'Set Remote IP
sckMain.Connect 'Connect
End Sub
Quote:

Private Sub Command2_Click()
If sckMain.State <> sckConnected Then 'If sckMain is not Connected then..
MsgBox "You are not connected", vbCritical, "Not Connected"
Exit Sub 'Stop Procedure
End If

sckMain.SendData Text2.Text 'Send Variable contents

End Sub
Quote:

Private Sub Timer1_Timer()

If sckMain.State = sckConnecting Then ' If sckMain is Connecting then...
Label1.Caption = "Connecting"
ElseIf sckMain.State = sckConnected Then 'If sckmain is Connected then...
Label1.Caption = "Connected"
Else 'If it is not any of the above then..
Label1.Caption = "Not Connected"
End If
End Sub





server




Quote:

Private Sub Form_Load()
sckMain.Close 'Close sckMain First
sckMain.LocalPort = "1884" ' Set Port to listen on"
sckMain.Listen ' Start Listening
End Sub

Quote:

Private Sub sckMain_ConnectionRequest(ByVal requestID As Long)
If sckMain.State <> sckClosed Then sckMain.Close
sckMain.Accept requestID 'Accept incoming Connection
End Sub

Quote:

Private Sub sckMain_DataArrival(ByVal bytesTotal As Long)
Dim Info As String
sckMain.GetData Info
Text1.Text = Info
End Sub

Quote:

Private Sub Timer1_Timer()
If sckMain.State = sckListening Then 'If sckMain is Listening then...
Label1.Caption = "Listening"
ElseIf sckMain.State = sckConnecting Then ' If sckMain is Connecting then...
Label1.Caption = "Connecting"
ElseIf sckMain.State = sckConnected Then 'If sckmain is Connected then...
Label1.Caption = "Connected"
Else 'If it is not any of the above then..
Label1.Caption = "Not Connected"
sckMain.Close 'Close sckMain First
sckMain.LocalPort = "1884" ' Set Port to listen on"
sckMain.Listen ' Start Listening
End If
End Sub

Viewing all articles
Browse latest Browse all 21848

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>