Go Down

Topic: UDP fails, sometimes (Read 1 time) previous topic - next topic


The gateway device accepting the packet does not check if the destination ip exists, just if it can route to that ip subnet.

If the route to the destination has an intermediate device, like a router, the router will take the packet and send it on if it can. If it can't, it drops the packet.

If the route to the destination is directly to the device, like on a localnet, the w5100 may wait a while for the destination device to take the packet. I do not know what the timeout on that would be if the receiving device does not accept the packet or no device present. I have not checked.


Since it definitely is not on the local net (eg, 192.168.0.xxx) then it should go into the router.  And the library should not hang.  But it does seem that way to happen that way.  Puzzling.


The router may take one packet, but it may not take any subsequent packets for the same ip until the next router takes that packet from it. Things could get clogged up fast. When things get clogged up, the first to go is UDP.

If you wish to guarantee a destination, may I recommend TCP instead of UDP.


The NTP servers use UDP, so TCP is not an option.  However, it might help to increase the UDP buffer size to 48 bytes or more so that it doesn't have to send a second packet and then get stuck.  I'll have a go the next time I'm reworking the code.


Nov 17, 2012, 01:48 pm Last Edit: Nov 17, 2012, 02:50 pm by SurferTim Reason: 1
How often are you calling the NTP function?

edit: The NTP code in the ethernet examples waits only a second for a return packet from the NTP server. I have not  experimented with what would happen if the packet arrives late (longer than a second).

Go Up