[En-Nut-Discussion] send UDP packet will cause Hang

ivesworking ivesworking at hotmail.com
Mon Dec 19 15:19:04 CET 2005


ok, i give more detail on the program flow

request side =PC
Response side = ethernut

first i create a listening on the board who handle request
after the request verify, it will send out UDP packet as response,
after the UDP packet send, the program will terminate
this listenning and response are all happen is around 5 second.
the program no need any response after the UDP packet send out.

the listening can handle up to 8K of the incoming, (i set the UDP buffer)
on theory (and tested)it can handle 32 request in very short period(around 1 
second)
(request packet around 256 byte)

the response are done in thread, which mean around 32 thread created for 
sending response.
each of the response thread can be send up to 50packet to the request side.

so now the total packet on queue on this 32 thread have around 1600packet 
that will be send out within 5 second.

due to UDP send out are by port and address,
on the request side, i close the port by terminate the program on listening,
on the ethernut side, it have around 1500 on the quest that sending the 
packet to no where.

i already program to terminated the thread when udpsend return a -1 value, 
However i never see -1 appear,

i run another thread which give a memory print out every 3 second to check 
the ethernut board are working fine.

Note: the program work fine and flawless if i try to continue give request, 
and my pc program listen to the response.
this happen only when i terminate the program after i send large amount of 
request,


PS:i set the program drop response if memory running low, so it will not 
harm the system stability.







----- Original Message ----- 
From: "Ernst Stippl" <ernst at stippl.org>
To: "'Ethernut User Chat (English)'" <en-nut-discussion at egnite.de>
Sent: Sunday, December 18, 2005 7:57 PM
Subject: AW: [En-Nut-Discussion] send UDP packet will cause Hang


Hi!

In the UDP protocol, the sender doe snot know if the packet "made it" to the
receiver. So, from this point, a "connection loss" can be
a) a loss of the user protocol which is implemented on top of UDP
b) a loss of the Ethernet carrier wire voltage

You say a ping is still possible, so it can't be b) and if the comms pgm on
the remote side end unexpecteldy, maybe your app within the Ethernut is
still waiting for receiving an UDP package from the comms program - which is
never sees. -> "Freeze" (well not really)
Try to "instrument" you app with some printf's to see exacly what's the
function from which there is no return into your app, maybe that help (you
may need to set timeouts when receiving packets).

regards
Ernst

-----Ursprüngliche Nachricht-----
Von: en-nut-discussion-bounces at egnite.de
[mailto:en-nut-discussion-bounces at egnite.de] Im Auftrag von ivesworking
Gesendet: Sonntag, 18. Dezember 2005 15:51
An: en-nut-discussion at egnite.de
Betreff: [En-Nut-Discussion] send UDP packet will cause Hang

MY application are using UDP packet as communication, if work flawless.
however on my final debug stage, i found that when the connection of the
other side of the communication loss, the ethernut board will freez.
i know it was possible to ping the destination before sending the packet,
however the connection loss i mention here is the communication program
surdently closed, but the computer still valid to accept ping.

i using 3.4 version of the Nut/OS 200407 Winavr

Wf






_______________________________________________
En-Nut-Discussion mailing list
En-Nut-Discussion at egnite.de
http://www.egnite.de/mailman/listinfo.cgi/en-nut-discussion

_______________________________________________
En-Nut-Discussion mailing list
En-Nut-Discussion at egnite.de
http://www.egnite.de/mailman/listinfo.cgi/en-nut-discussion



More information about the En-Nut-Discussion mailing list