Skip Menu |
 

This queue is for tickets about the IO CPAN distribution.

Report information
The Basics
Id: 43974
Status: resolved
Priority: 0/
Queue: IO

People
Owner: Nobody in particular
Requestors: mpapet [...] yahoo.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 1.2301
Fixed in: (no value)



Subject: IO::Socket::INET silently exits on Win32
Download (untitled) / with headers
text/plain 528b
use IO::Socket::INET; The following code exits silently on Win32 StrawberryPerl. According to most examples on the web, this should set up a server listening on UDP 1434. use strict; my $PORTNO = 1434; my $listensock = IO::Socket::INET->new ( LocalHost => "localhost", LocalPort => $PORTNO, Proto => "udp", Type => SOCK_DGRAM, QUEUE => 10, ReuseAddr => 1, ) or die " There's a problem with this server $! \n"; while ($listensock->accept()) { print "loop $forever \n"; $forever++ } # end relaying loop
Subject: Re: [rt.cpan.org #43974] IO::Socket::INET silently exits on Win32
Date: Mon, 9 Mar 2009 14:18:21 -0500
To: bug-IO [...] rt.cpan.org
From: Graham Barr <gbarr [...] pobox.com>
Download (untitled) / with headers
text/plain 818b
On Mar 9, 2009, at 2:13 PM, mpapet@yahoo.com via RT wrote: Show quoted text
> use IO::Socket::INET; > The following code exits silently on Win32 StrawberryPerl. > According to > most examples on the web, this should set up a server listening on > UDP 1434. > > use strict; > my $PORTNO = 1434; > my $listensock = IO::Socket::INET->new ( > LocalHost => "localhost", > LocalPort => $PORTNO, > Proto => "udp", > Type => SOCK_DGRAM, > QUEUE => 10, > ReuseAddr => 1, > ) or die " There's a problem with this server $! \n";
You have not created a listen socket, you have connected to whatever is listening on port 1434 Show quoted text
> while ($listensock->accept()) { > print "loop $forever \n"; > $forever++ > > } # end relaying loop
yes, accept will likely return undef is called on a socket other than a listen socket.
Download (untitled) / with headers
text/plain 779b
Show quoted text
> You have not created a listen socket, you have connected to whatever > is listening on port 1434 >
> > while ($listensock->accept()) { > > print "loop $forever \n"; > > $forever++ > > > > } # end relaying loop
> > yes, accept will likely return undef is called on a socket other than > a listen socket. >
O.K. Thanks for the feedback. But listening doesn't work. use strict; my $PORTNO = 1434; my $listensock = IO::Socket::INET->new ( LocalHost => "localhost", LocalPort => $PORTNO, Proto => "udp", Type => SOCK_DGRAM, Listen => 1, QUEUE => 10, ReuseAddr => 1, ) or die " There's a problem with this server $! \n"; while ($listensock->accept()) { print "loop $forever \n"; $forever++ } # end relaying loop Script ends with the "There's a problem... Unknown error"
Subject: IO::Socket::INET silently exits on Win32 Re-do
Download (untitled) / with headers
text/plain 515b
Show quoted text
> O.K. Thanks for the feedback. But listening doesn't work. > use strict; > my $PORTNO = 1434; > my $listensock = IO::Socket::INET->new ( > LocalHost => "localhost", > LocalPort => $PORTNO, > Proto => "udp", > Type => SOCK_DGRAM, > Listen => 1, > ReuseAddr => 1, > ) or die " There's a problem with this server $! \n"; > > while ($listensock->accept()) { > print "loop $forever \n"; > $forever++ > > } # end relaying loop > > Script ends with the "There's a problem... Unknown error"
I still get an error...
Subject: Re: [rt.cpan.org #43974] IO::Socket::INET silently exits on Win32
Date: Mon, 9 Mar 2009 17:20:25 -0500
To: bug-IO [...] rt.cpan.org
From: Graham Barr <gbarr [...] pobox.com>
Download (untitled) / with headers
text/plain 694b
On Mar 9, 2009, at 5:14 PM, mpapet@yahoo.com via RT wrote: Show quoted text
> > O.K. Thanks for the feedback. But listening doesn't work.
Show quoted text
> ) or die " There's a problem with this server $! \n";
I suspect that $! is not that useful on Win32. I am not a win32 user myself, but I believe there are other special vars you can look in. Show quoted text
> > > while ($listensock->accept()) {
The fact that this line did not fail when you did not have the Listen => 1 in you args list tell me that a connect succeeded in that case. If there is another process already listing on a socket then ant attempt to create another on the same port will fail. Try a different port number that you know is not being used. Graham.
From: mpapet [...] yahoo.com
Graham, You can close this bug as the core issue is different. Thanks for working with me.
Thanks again.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.