I have two interfaces on my server: eth0 and eth0: 0. These are two different external IP addresses and, obviously, two different reverse domains.
When I open the IO :: Socket :: INET connection, Perl uses the eth0 interface by default. I would like to use the second interface (eth0: 0) because it has a different IP address and I do not want to use my primary IP address or domain.
I do not know how to choose an interface to connect.
Here is the code I use to open the socket:
my $sock = new IO::Socket::INET(PeerAddr => $server, PeerPort => $serverPort, Proto => 'tcp') or die "Can't connect to server: $!";
interface perl sockets
Dieterve
source share