SunilRai86
SunilRai86

Reputation: 1020

Strange behavoir of recv function in winsock vc++

I am using Asynchronous socket.

the server sends MSG to client continuously. client receives all the MSG but sometimes two or three messages at one time.

Upvotes: 0

Views: 104

Answers (1)

valdo
valdo

Reputation: 12951

This is absolutely normal. Moreover, you are not guaranteed to read each time an integral number of your "messages". I mean, you may read 1.5 message (one and a half), then next time read 2.7 (the remaining half, two more, and a bit of the next), and so on.

You have to implement the logic that splits the stream into messages.

Upvotes: 1

Related Questions