sans-clue has asked for the wisdom of the Perl Monks concerning the following question:
I have searched first, yes. I wish not to pop out to shell (to perform a netstat -an function) in order to glean the remote ip address that is connecting to my simple listener
Is there a simple way to get the connecting ip ? I need to look it up in a table to determine what to do next. I currently have a cludgey `netstat -an |grep 6969|grep ESTAB.....` step in there that I'd like to rid of. Thanksuse IO::Socket; my $sock = new IO::Socket::INET ( LocalHost => 'hosty', LocalPort => '6969', Proto => 'tcp', Listen => 1, Reuse => 1, ); die "Could not create socket: $!\n" unless $sock; my $new_sock = $sock->accept(); while(<$new_sock>) { print $_; } close($sock);
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: IO Socket - Detect inbound IP
by BrowserUk (Patriarch) on Jan 25, 2011 at 17:23 UTC | |
by sans-clue (Beadle) on Jan 25, 2011 at 19:16 UTC | |
by BrowserUk (Patriarch) on Jan 25, 2011 at 21:19 UTC | |
by sans-clue (Beadle) on Jan 25, 2011 at 21:32 UTC | |
by Anonymous Monk on Jan 25, 2011 at 19:31 UTC | |
by ikegami (Patriarch) on Jan 25, 2011 at 19:34 UTC | |
by Anonymous Monk on Jan 25, 2011 at 21:27 UTC | |
by ikegami (Patriarch) on Jan 25, 2011 at 22:17 UTC | |
| |
Re: IO Socket - Detect inbound IP
by ikegami (Patriarch) on Jan 25, 2011 at 17:02 UTC | |
Re: IO Socket - Detect inbound IP
by rowdog (Curate) on Jan 26, 2011 at 00:48 UTC |
Back to
Seekers of Perl Wisdom