I've made the attached patch to prevent the situation where the udp-receiver
hang out indefinitly waiting for data when the server has been killed after
having started to send data.
In this case, the udp-received program would hang indefinitly.
Since in my program, udp-receiver is called through system(...); the result is
With this patch I use a SIGALARM signal to reset a flag to 0, and act as a
watchdog. The watchdog is started just before the sending data phase of the
protocol, and is feed each time a packet is received from the server.
If 2 times in a row the watchdog is not feed, the program exit in error.
The current value is set as a #define as 60s, which is in effect 2mn before
udp-receiver is actually killed.
However I am aware that this implementation is somehow crude, and I would be
interested by any other way to do that.
Additionally, if someone is interested by this patch, I could make it so that
the watchdog period is configurable on the command-line.
Thanks for your time,
People in the embedded space don't do prototypes. They hack something until it
works, then it's done.
Always code as if the person who will maintain your code is a maniac serial
killer that knows where you live