
SendData method for winsock control 6.0
I am currently developing in
Visual Basic 6.0 and have come accross a
problem using SendData.
I am using Windows CE on the client computer and Windows2000 for the server.
Here is some sample
psuedo code and the undesired result.
CLIENT computer's code:
Private Sub cmdSendMessage_Click()
frmConnect.WinSock1.SendData "BillyGoat" // Sends "BillyGoat" to the
server computer
End Sub
SERVER computer's code:
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim strData // data (as a string) that has been
sent by client
Winsock1.GetData strData // data sent by client is loaded into strData
Dim Message
Message = MsgBox("strData= " & strData, vbOKOnly)
End Sub
The result of this code is two message boxes. The first will display:
strData= B
The second message box will display: strData= illyGoat
Apparently SendData breaks off the first character and sends it. Then sends
the rest of the
string. I want to know why this happens, if it is supposed to happen, and
how to send and receive
the entire string as a single block of data. Thanks.