Home > Software engineering >  Vb winsock to send and receive data, to solve!
Vb winsock to send and receive data, to solve!

Time:10-01

The receiving party
Private Sub tcpClient_DataArrival (ByVal bytesTotal As Long)
Dim strData As Long
TcpClient. GetData strData
If strData=https://bbs.csdn.net/topics/0 Then
MsgBox "is connected!" , vbOKOnly + vbInformation, "message"
Label3. Caption="already connected!"
The Else
Msgbox strdata
End the If
End Sub
The sender
Private Sub sending pictures id ()
TcpServer. SendData publishes the event (number)
End Sub
Serial number has been defined as a global variable
If the code over here that everything is all right, if add the following code will appear to send and receive,
Private Sub tcpServer_DataArrival (ByVal bytesTotal As Long)
Dim ask As Long
TcpServer. GetData ask
If ask=0 Then
TcpServer. SendData publishes the event 0
End the If
End Sub
This code is the receiver of began to connect to the server to send information, shaking hands, look to whether connection, but I don't understand why added distortion leads to accept?
Hope to guide thank!

CodePudding user response:

Don't know how many predecessors in the TCP Socket
Send (many) send (less) send (wealth)
Has been so much illness recv (), recv (wealth)
Inside the trap!
http://bbs.csdn.net/topics/380167545
  • Related