IO::Socket::INET nonblocking confusing

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I am confused with the IO::Socket module

When I attempt to open a "blocking" udp socket with the following

my $sock = new IO::Socket::INET(
                   PeerAddr => $addr,
                   PeerPort => $port,
                   Proto    => 'udp',
                   Blocking => 1);
$sock or die "no socket :$!, $@\n";

It returns "no socket:......"

If I remove the "Blocking => 1" option, the socket is created
successfully. Anyone knows how to enable the "Blocking" option

Calling the following line afterwards:
   $len = $sock->recv( my $reply, 128);

As it is said that the default socket will be a "blocking" one, I
expect it to wait until there is new data. However, it returns
immediately, with an undefined $len.

Is it the normal behavior?

Re: IO::Socket::INET nonblocking confusing

Quoted text here. Click to load it

Complete with the ellipsis?  If not, what is the actual error message you

What is your OS and version of IO::Socket and IO::Socket::INET?

Quoted text here. Click to load it

What is in "$!" after recv returns?


-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB

Site Timeline