I know this is properly the third time asking the same question,
but I can't get my WinSock program to work!!!
The program must send text strings between to computers...
Computer no.1 has a static IP set to: 1.0.0.1 (When I call the following command: Winsock1.LocalIP, it returns:
246.132.155.221! Could this be the error??)
Computer no.2 also has a static IP which is 1.0.0.2
Ok....here is the problem: When I'm trying to connect to 1.0.0.2 from my app, the WinSock state is 6, but it must be 7.....I
can't get it go 7!!!!
Here is the code for the client (1.0.0.1)
Here is the code for the server (1.0.0.2)Code:Private Sub cmdConnect_Click() Winsock1.Connect txtIP.Text, 1234 Debug.Print Winsock1.State End Sub Private Sub cmdSend_Click() Winsock1.SendData txtData.Text End Sub Private Sub Winsock1_Connect() Me.Caption = "Connected" End Sub
Could some of you please tell me what I'm doing wrong?????Code:Private Sub cmdListen_Click() Winsock1.LocalPort = 1234 Winsock1.Listen End Sub Private Sub Form_Load() Winsock1.LocalPort = 1234 Winsock1.Listen End Sub Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long) Winsock1.Accept requestID End Sub Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long) Dim strData As String Winsock1.GetData strData, vbString txtData.Text = strData End Sub
Thanks in advance!




Reply With Quote