[tpm] IO::Socket::INET listening on the 2nd ip address
uri at StemSystems.com
Tue Feb 8 08:22:05 PST 2011
>>>>> "AS" == Antonio Sun <antoniosun at lavabit.com> writes:
AS> $sock = new IO::Socket::INET ( LocalHost => '0.0.0.0',
AS> LocalPort => '80',
AS> Proto => 'tcp',
AS> Listen => 30,
AS> Reuse => 1);
don't use the indirect call of new Class. make it Class->new().
also you don't need all of those options as several are
defaulted. proto, reuse are defaulted as you set them.
AS> which will fail because my port 80 on localhost is used by web server.
AS> How can I change the code to listen on the 2nd ip address?
AS> I.e., my current IP address is 192.168.0.100, it is
AS> also accessible at 192.168.0.101. I want that
AS> visiting 192.168.0.100 will land to my normal web server, while
AS> visiting 192.168.0.101 will be handled by the code above.
kind of obvious. you set localhost to the ip you want. that binds the
listen socket to that and the port pair which is unique on your box.
Uri Guttman ------ uri at stemsystems.com -------- http://www.sysarch.com --
----- Perl Code Review , Architecture, Development, Training, Support ------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
More information about the toronto-pm