Home > Archive > PERL Modules > April 2007 > IO::Socket::INET nonblocking confusing
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
IO::Socket::INET nonblocking confusing
|
|
|
| I am with the IO::Socket module
When I attempt to open a "blocking" udp socket with the following
lines:
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
gracefully?
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?
| |
| xhoster@gmail.com 2007-04-25, 6:58 pm |
| DGG <tong.yin@nectech.co.uk> wrote:
> I am with the IO::Socket module
>
> When I attempt to open a "blocking" udp socket with the following
> lines:
>
> my $sock = new IO::Socket::INET(
> PeerAddr => $addr,
> PeerPort => $port,
> Proto => 'udp',
> Blocking => 1);
> $sock or die "no socket :$!, $@\n";
>
> It returns "no socket:......"
Complete with the ellipsis? If not, what is the actual error message you
get?
What is your OS and version of IO::Socket and IO::Socket::INET?
> If I remove the "Blocking => 1" option, the socket is created
> successfully. Anyone knows how to enable the "Blocking" option
> gracefully?
>
> 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.
What is in "$!" after recv returns?
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
| |
|
|
|
|
|