develooper Front page | perl.perl5.porters | Postings from November 1999

Re: Make IO::Socket::INET pick up LocalAddr from the ENVIRONMENT

Thread Previous | Thread Next
From:
Graham Barr
Date:
November 15, 1999 15:05
Subject:
Re: Make IO::Socket::INET pick up LocalAddr from the ENVIRONMENT
Message ID:
19991115230148.A3593@pobox.com
On Thu, Oct 28, 1999 at 12:36:38PM +0200, Gisle Aas wrote:
> If you don't specify a LocalAddr, then the socket will not be bound,
> and the OS will automatically choose some interface based on the route
> taken to reach the PeerAddr.  For hosts with multiple interfaces
> LocalAddr can be used to choose which route you want.  The default
> should still be not to bind the socket.

Yes, but having a global at the IO::Socket level is not the right thing
to do. There are some applications where you have to use different
LocalAddr depending on where you are connecting. Right now a port
will be correctly selected, but with this proposal you may end up
forcing the use of a port which has no route to your destination.

Which means every module which uses IO::Socket will either have to start
specifying a LocalAddr, just incase a global has been spcified, or
do a local($IO::Socket::INET::LocalAddr) or whatever.

IMO, the LocalAddr information should be passed via new().

Graham.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About