A
Al the Pal
I'm sorry if this is a repost. I thought I posted this, but don't see
it on the board, so I'll try again.
Hi Geniuses,
Probably an easy one, but I can't find the answer.
I have a server with several IP addresses, and when I make a socket, I
want control over which IP address I connect from.
Right now I use this:
my $iaddr = Socket::inet_aton($server) || return 0;
my $paddr = Socket::sockaddr_in($port, $iaddr) || return 0;
my $proto = getprotobyname('tcp');
socket(TCP, Socket:F_INET, Socket::SOCK_STREAM, $proto) || return 0;
connect(TCP, $paddr) || return 0;
How can I make this code force the local IP address to what I want?
Thanks in advance.
- Alex
it on the board, so I'll try again.
Hi Geniuses,
Probably an easy one, but I can't find the answer.
I have a server with several IP addresses, and when I make a socket, I
want control over which IP address I connect from.
Right now I use this:
my $iaddr = Socket::inet_aton($server) || return 0;
my $paddr = Socket::sockaddr_in($port, $iaddr) || return 0;
my $proto = getprotobyname('tcp');
socket(TCP, Socket:F_INET, Socket::SOCK_STREAM, $proto) || return 0;
connect(TCP, $paddr) || return 0;
How can I make this code force the local IP address to what I want?
Thanks in advance.
- Alex