Clear questions and runnable code
get the best and fastest answer
UDP connectionby falstad (Novice)
|on May 03, 2012 at 06:28 UTC||Need Help??|
falstad has asked for the
wisdom of the Perl Monks concerning the following question:
I'm new to networking and threading in Perl, and I got the following task which I can't solve.
We have a server which listens on 4 ports. And once it receives a "heartbeat" (a byte containing "01") it sends a response to the IP and port the hb came from (byte containing "25"). This sets up the connection. We have to repeat this in every 10 seconds to keep it alive. After the the server got the first hb it starts to send hexdumps to the client which we have to log into files.
If everything went fine we should have 4 threads signaling the server. 4 other threads listening to the responses and logging the hexdumps.
The problem is that I can't manage to simultaneously listen to the same port and send on it. I have to use UDP and can't afford to miss anything the server sends. Also the code of the server can't be changed.
I got it to work. Thank you for all the replies. Now, as a finishing touch I have to log the result of the recv to a file as the following pattern:
0A 16 68 00 96 44 01 08 08 05 12 20 3B 00 00 00
Do you have a good idea how can I do the conversion?