Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parsing data sent thru Winsock control...

Status
Not open for further replies.

GWhiz

Programmer
Dec 16, 1999
49
US
Hi, folks!

I'm trying to send/receive data through Winsock in a VB app. Using .Sendata in a loop only seems to trigger a single Data_Arrival event in the receiving app, instead of a series of Data_Arrival events corresponding with the number of times .Sendata appears in the sending loop.

However -- bytes received (as shown in Data_Arrival event) corresponds with the total amount of data sent in the loop.

SendComplete event seems totally useless -- it is not triggered with each send event, so there seems to be no way for the receiving end to distinguish between the end of one .Sendata and the beginning of the next one.

So -- if you have a 426-byte receive buffer full of integers (which I assume is 213 two-byte integer values), how does one use .GetData to parse that receive buffer to recover the individual integer values?

Respectfully,

GWhiz
 
You could specify a value to indicate "end of file". This is typically -1, but will depend on your particular application and should be a number that otherwise would not appear. The sending program would add that to the end of its message, and the receiving program would look for it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top