Write a program which will identify public IP address of the current host.
sub get_tm_ip {
my($host_to_contact) = shift; < ---- it can be any
pingable hostname
(e.g. google.com )
my($port) = 22;
my $sock = IO::Socket::INET->new(
PeerAddr=> $host_to_contact,
PeerPort=> $port,
Proto => "tcp");
my $localip = $sock->sockhost;
return($localip);
}
No comments:
Post a Comment