-
I am having problems with the dataArrival event on the server side of a winsock connection.
I have a loop on the client side, sending an byte array of 4096 bytes at a fairly constant rate.
My problem is that after a random number of calls to the dataArrival event by the server, it is not receiving all of the data. For example after 10 loops on the client side (sending data), the dataArrival will be called after only receiving half of the data.
Anyone know about this problem?? Or when dataArrival is supposed to be called (ie. When the first bit of data arrives, all the data, half way...)??
I've been stuck on this bug for 3 days. I need help!!
Thanks!
-
I've just sterted using winsock and it could be because you are sending to much data too quick for the client to be able to hanlde with ???
-
I don't know because I'm not sure what happens when you send too much data to be processed. I think it must be put on a stack at the client end, waiting to be processed. Sending too much data doesn't seem to be a problem, it processes it fine. The problem is when the DataArrival event is called when the full packet (4096bytes) hasn't arrived.
-
When you use winsock there is a function to do with data arrival and there is a string to do with bytes use that so that if the number of bytes = the amount you want it will do what you want :
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
If bytesTotal = 4096 Then
'Put Stuff Here
End If
End Sub
-
Someone tell me about a bug of Winsock, and the solution was insert DoEvent follow SendData, in order to clear buffer of Winsock packets. I hope you find the final solution.
Good luck !
-
I had the same problem with winsock a couple of months ago. The problem I faced was that the timer event I was using to send data was being executed too quickly for the winsock control. I eventually had to lower the resolution to 200ms.
A better solution I found was to use National Instruments' DataSocket control to pass data. This control connects similar to winsock, but allows for near-real-time transfer of data between client and server.