Skip Menu |

This queue is for tickets about the IO-Socket-IP CPAN distribution.

Report information
The Basics
Id: 79246
Status: resolved
Priority: 0/
Queue: IO-Socket-IP

People
Owner: Nobody in particular
Requestors: JSTROM [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Unimportant
Broken in: (no value)
Fixed in: 0.25



Subject: Handling of PeerPort incompatible with IO::Socket::INET
If IO::Socket::INET receives both a PeerAddr with port information and PeerPort, it ignores the value of PeerPort and extracts the port from PeerAddr. IO::Socket::IP returns an error. Attached is a script that demonstrates the problem. Doubt this is worth fixing, but maybe this ticket will save someone a dive through the socket code. This was only an issue for me due to a bizarre set of circumstances (changed the backing IO::Socket of Net::POP3 which always supplies PeerPort).
Subject: error.pl
use threads; use IO::Socket::INET; use IO::Socket::IP; sub monitor_port { my ($port) = @_; my $local = IO::Socket::INET->new( LocalPort => $port, Listen => 1, Proto => 'tcp', ); my $peer,$addr; while( $peer = $local->accept ) { printf STDERR "Received connection on %d: %s:%d\n", $port, $peer->peerhost, $peer->peerport; $peer->close; } } threads->create( \&monitor_port, 2000 ); threads->create( \&monitor_port, 3000 ); print STDERR "IO::Socket::INET\n"; IO::Socket::INET->new( PeerAddr => '127.0.0.1:2000', PeerPort => 3000, ) or die $!; print STDERR "IO::Socket::IP\n"; IO::Socket::IP->new( PeerAddr => '127.0.0.1:2000', PeerPort => 3000, ) or die $!;
On Mon Aug 27 19:58:27 2012, JSTROM wrote: Show quoted text
> If IO::Socket::INET receives both a PeerAddr with port information and > PeerPort, it ignores the value of PeerPort and extracts the port from > PeerAddr. IO::Socket::IP returns an error. Attached is a script that > demonstrates the problem. > > Doubt this is worth fixing, but maybe this ticket will save someone a > dive through the socket code. This was only an issue for me due to a > bizarre set of circumstances (changed the backing IO::Socket of > Net::POP3 which always supplies PeerPort).
Hrm, that seems a little awkward. I wonder if perhaps instead of an outright error, IO::Socket::IP ought to just give a warning. I'm trying to aim at good drop-in replacement for ::INET, so it might be better to at least carry on and behave the same way, just print a warning also to suggest this isn't a good idea. -- Paul Evans
This was changed in 0.25 to be the same as INET -- Paul Evans