UDP messages lost in Ip-stack ?
- From: Lasse <Lasse-NO@xxxxxxxxxxxxxxxx>
- Date: Wed, 26 Sep 2007 01:11:59 +0200
Hi all
Scenario for lost UDP messages
1. Pc A sends UDP messages. Each message has a sequence number.
2. Pc B receives these messages, and sends an ACK to each message.
3. PC A can send max 3 messages ahead before next is sent.
Meaning message 'n+4' is not sent before ACK 'n' has been received.
4. If a message is lost, the receiver will get an incorrect
sequence number and send a NACK. If an ACK is lost the
sender will get a timeout waiting for the ACK.
5. In both these cases the messages, starting from the lost, are
retransmitted, and everything will be fine.
This protocol is used to get a fast secure transmission.
Sometimes messages are lost, but the recovery works ok.
Now my problem - Sometimes messages are lost - why ? - it is NOT a network problem.
The reciver code looks like:
-----
// The parameters lpOverlapped and lpCompletionRoutine are both NULL
r = WSARecvFrom(...);
if(r==0) //Ok
{
printf(" some information including Sequence number");
... perform some action ...
}
else
printf("ERROR ....");
-----
A network listener is used to monitor the traffic.
The strange thing is that the network listener shows that the lost
message has been received, but nothing has been printed by printf().
It seems to me, the message is lost somewhere between the point
where the network listener gets it and where WSARecvFrom() should
return it. (the Ip-stack).
Note: This has nothing to do with overflow in socket receivbuffer
since there could be max 3 unread messages.
I also wrote a simple listener using raw sockets. It shows the
same result.
- In some situations I never get any lost messages.
- The errors occur on several machines.
- Messages are not fragmented.
- Windows XP
- The same error occurs for Multicast and Unicast.
- A small local 1 Gigabit network is used.
- There are lots of threads dealing with sockets in my SW.
My questions:
- Could it really be so that messages are lost in the IP-stack ?
That is what my test resluts tell me.
I doubt it, but what else could it be ?
- Could it be so that my software somewhere is buggy and
overwrites some data e.g. in the Ip-stack ?
- How shall I proceed to solve the problem.
I need tips and ideas.
Lasse
.
- Follow-Ups:
- Re: UDP messages lost in Ip-stack ?
- From: Arkady Frenkel
- Re: UDP messages lost in Ip-stack ?
- From: Joe Butler
- Re: UDP messages lost in Ip-stack ?
- From: Carl Daniel [VC++ MVP]
- Re: UDP messages lost in Ip-stack ?
- From: Scott McPhillips [MVP]
- Re: UDP messages lost in Ip-stack ?
- Prev by Date: Re: Need Help Debugging
- Next by Date: Re: UDP messages lost in Ip-stack ?
- Previous by thread: Need Help Debugging
- Next by thread: Re: UDP messages lost in Ip-stack ?
- Index(es):