in reply to Re^2: UDP Client Multiple servers
in thread UDP Client Multiple servers
That's not really a good idea. You could just set timeout option on the socket after creating it:
use Socket qw(SO_RCVTIMEO); use POSIX qw(:errno_h); ...; my $timeout = pack 'L!L!', $sec, $usec; $handle->sockopt(SO_RCVTIMEO, $timeout); ...; my $res = $handle->recv(...); unless(defined $res) { if($! == EAGAIN or $! == EWOULDBLOCK) { say "time out"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: UDP Client Multiple servers
by brap (Pilgrim) on Oct 12, 2012 at 13:18 UTC | |
by zwon (Abbot) on Oct 12, 2012 at 14:26 UTC | |
by brap (Pilgrim) on Oct 12, 2012 at 14:45 UTC |