perl -mHTTP::Daemon -e '$d=new HTTP::Daemon(LocalPort=>12345);while ($c=$d->accept){sleep 10;$c->send_file_response("index.html")}'
####
perl -e 'use LWP::Simple;@LWP::Protocol::http::EXTRA_SOCK_OPTS = (LocalAddr=>"localhost:54321");get("http://localhost:12345")'
##
##
tcp 71 0 mondas:12345 mondas:51575 ESTABLISHED
##
##
[jj@mondas jj]$ perl -le 'use LWP::Simple;@LWP::Protocol::http::EXTRA_SOCK_OPTS = (LocalAddr=>"192.168.1.1:54321");getprint("http://jonallen.info/cgi/delay.pl");'
Hello, World!
##
##
[jj@mondas jj]$ perl -e 'use LWP::Simple;@LWP::Protocol::http::EXTRA_SOCK_OPTS = (LocalAddr=>"192.168.1.1:54321");getprint("http://www.google.com");'
500 Can't connect to www.google.com:80 (Cannot assign requested address)
##
##
[root@mondas log]# ifconfig
eth0 Link encap:Ethernet HWaddr 52:54:05:C5:13:7A
inet addr:192.168.1.1 Bcast:192.168.1.255 Mask:255.255.255.0
EtherTalk Phase 2 addr:65280/97
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:27996973 errors:0 dropped:2 overruns:0 frame:6
TX packets:32099772 errors:484 dropped:0 overruns:0 carrier:968
collisions:146707
RX bytes:3038904039 (2898.1 Mb) TX bytes:4085277291 (3896.0 Mb)
eth0:0 Link encap:Ethernet HWaddr 52:54:05:C5:13:7A
inet addr:192.168.1.10 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
EtherTalk Phase 2 addr:0/0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:17172 errors:0 dropped:0 overruns:0 frame:0
TX packets:17172 errors:0 dropped:0 overruns:0 carrier:0
collisions:0
RX bytes:4381193 (4.1 Mb) TX bytes:4381193 (4.1 Mb)
##
##
[jj@mondas jj]$ perl -e 'use LWP::Simple;@LWP::Protocol::http::EXTRA_SOCK_OPTS = (LocalAddr=>"192.168.1.1:8080");getprint("http://jonallen.info/cgi/delay.pl");'
500 Can't connect to jonallen.info:80 (Address already in use)
[jj@mondas jj]$ perl -e 'use LWP::Simple;@LWP::Protocol::http::EXTRA_SOCK_OPTS = (LocalAddr=>"192.168.1.10:8080");getprint("http://jonallen.info/cgi/delay.pl");'
500 Can't connect to jonallen.info:80 (Address already in use)
##
##
perl -e 'use LWP::Simple;@LWP::Protocol::http::EXTRA_SOCK_OPTS = (LocalAddr=>"192.168.1.8:11111");getprint("http://192.168.1.1:12345");'
##
##
perl -e 'use LWP::Simple;@LWP::Protocol::http::EXTRA_SOCK_OPTS = (LocalAddr=>"192.168.1.1:11111");getprint("http://jonallen.info/cgi/delay.pl");'
##
##
tcp 0 0 mondas.coldsoluti:11111 212.69.202.117:http ESTABLISHED
tcp 73 0 mondas.coldsoluti:12345 lclus1.coldsoluti:11111 ESTABLISHED