C
Colin Robbins
I have a network application that works fine on Linux, and I want to run it
on on a Windows XP machine. For some reason I cannot get the TCP listener
to respond.
I have cut the code down to the bare minimum to try and debug...
use IO::Socket;
use Net::hostent;
$PORT = 2345;
$server = IO::Socket::INET->new( Proto => 'tcp',
LocalPort => $PORT,
Listen => SOMAXCONN,
Reuse => 1);
die "can't setup server" unless $server;
print "[Server $0 accepting clients]\n";
while ($client = $server->accept()) {
$hostinfo = gethostbyaddr($client->peeraddr);
printf "Connect from %s\n", $hostinfo->name ||
$client->peerhost;
$line = <$client>;
print "Got: $line \n";
close $client;
}
When I run this, and connect a client, I get as far as the "Connect from..."
message, but the $line=<$client> never returns anything.
Any ideas why this will not work on XP?
I am using ActivState perl 5.8.0.
on on a Windows XP machine. For some reason I cannot get the TCP listener
to respond.
I have cut the code down to the bare minimum to try and debug...
use IO::Socket;
use Net::hostent;
$PORT = 2345;
$server = IO::Socket::INET->new( Proto => 'tcp',
LocalPort => $PORT,
Listen => SOMAXCONN,
Reuse => 1);
die "can't setup server" unless $server;
print "[Server $0 accepting clients]\n";
while ($client = $server->accept()) {
$hostinfo = gethostbyaddr($client->peeraddr);
printf "Connect from %s\n", $hostinfo->name ||
$client->peerhost;
$line = <$client>;
print "Got: $line \n";
close $client;
}
When I run this, and connect a client, I get as far as the "Connect from..."
message, but the $line=<$client> never returns anything.
Any ideas why this will not work on XP?
I am using ActivState perl 5.8.0.