in reply to Bind Socket client to specific IP

I don't pretend to know the Socket module and you don't clarify whether you're after "more control" of your socket solely for the purpose of binding to an arbitrary IP, but IO::Socket::INET is quite capable of doing so ...

#!/usr/bin/perl use IO::Socket; use constant DEFAULT_SERVER => "whois.networksolutions.com"; use constant DEFAULT_IP => "0.0.0.0"; # any sub whois { my($domain,$server,$ip) = @_; $server ||= DEFAULT_SERVER; $ip ||= DEFAULT_IP; my $whois = IO::Socket::INET->new( PeerAddr => $server, PeerPort => "whois(43)", Proto => "tcp", LocalAddr => $ip, ); return unless defined $whois; $whois->print( "$domain\r\n" ); return $whois->getlines; } die("Usage: $0 domain [whois server [local ip]]\n") unless @ARGV; print whois(@ARGV);

If you still need to use Socket instead of IO::Socket::INET, perhaps a peek under the hood of the latter is in order so you can figure out how the above wraps around the lower level stuff.

    --k.