Discussion:
Missing packets
(too old to reply)
dushkin
2011-08-07 18:11:16 UTC
Permalink
Hi,

I have a simple sockets server.

It consists of a socket with which I accpet requests. Then I create a
thread, attaching to it a socket with which keeps the connection to my
client.

I use the regular socket callbacks like: OnConnect, OnReceive, etc.

The problem is that out of, lets say, 1000 requests, there are about
1% missing. With wireshark it seems that the requests arrives to my
server pc, but on OnReceive I don;t see any evidence of that.

Also , CAsyncSocket::Receive() uses a large enough buffer for all
possible requests.

Any advise would be blessed.

Thanks.
Joseph M. Newcomer
2011-08-07 23:31:31 UTC
Permalink
I have never seen TCP/IP fail. I have seen dozens of badly-written programs that fail.
The evidence of what you are doing suggests that you are not using sockets correctly, if
your code sample is any indication of what you did. What is surprising is that the code
*ever* worked. Note that I have no idea what "large enough for all possible requests"
could mean, because there is no indication that you are parsing for packets, or
maintaining partial-packet-state. The fact that you pass pointers to a buffer and do not
pass a length is compelling evidence your code is wrong.

Since you do not show anything to contradict these assumptions, I have to assume you have
made the same mistake most beginners make: they think there is some concept of "packet
integrity" maintained by the receiver. There is not.
joe
Post by dushkin
Hi,
I have a simple sockets server.
It consists of a socket with which I accpet requests. Then I create a
thread, attaching to it a socket with which keeps the connection to my
client.
I use the regular socket callbacks like: OnConnect, OnReceive, etc.
The problem is that out of, lets say, 1000 requests, there are about
1% missing. With wireshark it seems that the requests arrives to my
server pc, but on OnReceive I don;t see any evidence of that.
Also , CAsyncSocket::Receive() uses a large enough buffer for all
possible requests.
Any advise would be blessed.
Thanks.
Joseph M. Newcomer [MVP]
email: ***@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm

Loading...