mhirschb has asked for the wisdom of the Perl Monks concerning the following question:
Hello Monks,
I should write a thin and easy emulation of a networked device which is controlled by simple UDP commands. The device listens to UDP port 7070 and if a request arrives, it immediately responses with some status data.
I solved this easily withuse IO::Socket; my $PORTNO = 7090; $sock = IO::Socket::INET->new(LocalPort => $PORTNO, Proto => 'udp') while ($sock->recv($request, $MAXLEN)) { $response=parseRequest($request); $sock->send($response); }
My problem is, that this box should also send time-triggered status notifications every five seconds. Additionaly, these "five seconds" and the content of the status notifications are modified by the incoming request.
Currently, I have no clear idea, how the solution might look like. Any hint?
Thanks for your time!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: UDP Client and Server in one
by NetWallah (Canon) on Mar 06, 2017 at 07:08 UTC | |
|
Re: UDP Client and Server in one
by tybalt89 (Monsignor) on Mar 06, 2017 at 22:00 UTC | |
|
Re: UDP Client and Server in one
by thanos1983 (Parson) on Mar 06, 2017 at 09:06 UTC |