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
Graham Barr
November 15, 1999 15:05
Re: Make IO::Socket::INET pick up LocalAddr from the ENVIRONMENT
Message ID:
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().


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About