Winsock Help........ may be its tricky...
i am receiving data from winsock.getdata sdata
the arrival data is big & comes in part by part that causes dataarrival event to fire more than 1 time........ how can i get whole data once & fire the arrival event once..
even with winsock.peekdata the event is fired more than 1 time..
??
thnx in adv
Re: Winsock Help........ may be its tricky...
That's how Winsock works. You can't receive large amounts of data at once. The DataArrival event fires multiple times with small chunks of data of a few kilobytes in size. You will have to buffer the incoming data and check if everything has been received.
This is a very basic example.
vb Code:
Private sBuffer As String
Private Sub Winsock_DataArrival(ByVal bytesTotal As Long)
Dim sData As String
Winsock.GetData sData, vbString 'get data
sBuffer = sBuffer & sData 'buffer data
If InStr(1, sBuffer, "<end of data>") Then 'look for the end of the data
'all data has been received
End If
End Sub