[En-Nut-Discussion] Problem with UDP sockets

Martin Kresse m.kresse at cut5-systemhaus.de
Tue Oct 14 12:30:06 CEST 2003


Ralph Mason wrote:

>Sounds like a problem with your protocol is more to blame.
>  
>
Just what I meant :-)
I now request only single respose packets and use a timeout to rerequest 
it, and it seems to work fine.

>UDP has no guaranteed delivery so you need to make your protocol aware of
>
Since my application is limited to a small LAN, I don't assume that many 
packets actually get lost.

>that and handle it accordingly. You are correct there is no flow control
>other than network contention.
>
>This is why tcp was invented.
>
TCP didn't work for me due to some repeatedly occuring very high 
request-response delay values. The data blocks sent from the server were 
usually around 1k, the required data rate around 32kb/s and most 
request-response cycles took less than a tick (63ms), but every now and 
then a cycle took more than 500ms and my buffer drained. Both sides were 
in my opinion optimized carefully, the server was definitely sending the 
requested data out fast enough. I tried to decrease my buffer to leave 
enough heap memory for Nut/Net (which helped to some extend) and spread 
my code with Yields, but I couldn't get rid of these delays completely.
Using udp, the average request-response time lies around 4ms now and 
never exceeds 63ms.

Martin




More information about the En-Nut-Discussion mailing list