Displaying 1 result from an estimated 1 matches for "client_ipnum".
Did you mean:
client_input
2006 Feb 05
2
R socket communication
...INADDR_ANY);
bind(SERVER, $paddr) or die "bind: $!";
listen(SERVER, SOMAXCONN) or die "listen: $!";
print "SERVER started on port $port ";
my $client_addr;
while ($client_addr = accept(CLIENT, SERVER))
{
my ($client_port, $client_ip) = sockaddr_in($client_addr);
my $client_ipnum = inet_ntoa($client_ip);
my $client_host = gethostbyaddr($client_ip, AF_INET);
print "Connection from: $client_host","[$client_ipnum] ";
while(<CLIENT>){
print "$_";
}
close CLIENT;
}