Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

How do I bind to a particular Interface ?

by niley (Initiate)
on Aug 08, 2002 at 20:42 UTC ( [id://188734]=perlquestion: print w/replies, xml ) Need Help??

niley has asked for the wisdom of the Perl Monks concerning the following question: (network programming)

When creating connections to servers, how can I use a particular interface to make the outgoing connection?
I currently create connections with the following code:
IO::Socket::INET->new( PeerAddr => $Remote, PeerPort => $Port, Proto = +> 'tcp' );
All pointers in the right direction appreciated.

Originally posted as a Categorized Question.

Replies are listed 'Best First'.
Re: How do I bind to a particular Interface ?
by sauoq (Abbot) on Aug 09, 2002 at 01:39 UTC
    You can use IO::Socket::INET's LocalAddr property to force the packets out a specific interface.
Re: How do I bind to a particular Interface ?
by hnd (Scribe) on Jun 29, 2009 at 20:54 UTC
    use IO::Scoket; $socket= new IO::Socket( LocalAddr=>$host, LocalPort=>$port, ..... #other arguments ) or die "socket not created\n";
    the $host is the IP of the interface you want and the $port is the port number you want the service to run....

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://188734]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (5)
As of 2024-04-23 07:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found