motzi has asked for the wisdom of the Perl Monks concerning the following question:

Hello monks, my question is how to use timeout on udp socket in win32? (without using io::socket) For example, in this simply code:
use Socket; $servaddr = 'some.org'; $servport = 29015; $proto = getprotobyname 'udp'; $naddr = inet_aton $servaddr; $paddr = sockaddr_in $servport, $naddr; $text = 'blah, my udp message'; socket MY_SOCK, AF_INET, SOCK_DGRAM, $proto; send (MY_SOCK, $text, 0, $paddr) == length $text; recv MY_SOCK, $recved_data, 1024, 0; close MY_SOCK;
Thanks.

Replies are listed 'Best First'.
Re: Udp timeout
by ikegami (Patriarch) on Nov 18, 2008 at 19:09 UTC
    I never tried select on UDP sockets, but I don't see why it wouldn't work like it does for TCP sockets. IO::Select provides a better interface to the system call.