Re: UDP messages lost in Ip-stack ?
- From: "Joe Butler" <ffffh.no.spam@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 26 Sep 2007 05:21:47 +0100
I'd assume your code, based on the following:
I used a UDP sockets library that someone else wrote and when I tested it by
looking at sequence numbers, it had dropped 1 packet out of 1 million sent
packets over the space of about an hour I think.
The test was on a 100 Mbit network under win2k, though, and the machine was
probably running at about 10% processor load, if that.
What happens if you run your program on a dual core compared to a single
core? I.e. are you sure you can't discount a threading issue?
"Lasse" <Lasse-NO@xxxxxxxxxxxxxxxx> wrote in message
news:uo9Dol8$HHA.4324@xxxxxxxxxxxxxxxxxxxxxxx
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
.
- References:
- UDP messages lost in Ip-stack ?
- From: Lasse
- UDP messages lost in Ip-stack ?
- Prev by Date: Re: UDP messages lost in Ip-stack ?
- Next by Date: Re: Need Help Debugging
- Previous by thread: Re: UDP messages lost in Ip-stack ?
- Next by thread: Re: UDP messages lost in Ip-stack ?
- Index(es):
Loading