io ho un problema sun un programma in perl client-server.
il problema è che la connessione avviene perfettamente, ma cade subito! il codice è questo:
SERVER:

#/usr/bin/perl -Tw

#
# A sample TCP server using Internet-domain sockets
#

require 5.002;
use strict;
BEGIN { $ENV{PATH} = '/usr/ucb:/bin' }
use Socket;
use Carp;

sub logmsg { print "$0 $$: @_ on ", scalar localtime, "\n" }

my $port = 4500;
my $proto = getprotobyname "tcp";

socket(Server, PF_INET, SOCK_STREAM, $proto) || die "socket error: $!";
setsockopt(Server, SOL_SOCKET, SO_REUSEADDR, pack("l", 1)) || die "setsockopt error: $!";
bind(Server, sockaddr_in($port, INADDR_ANY)) || die "bind error: $!";
listen(Server, SOMAXCONN) || die "listen error: $!";

logmsg "server started on port $port";

my($paddr, $i);

$SIG{CHLD} = \&REAPER;

for (; {

$paddr = accept Client, Server;
my($port, $iaddr) = sockaddr_in($paddr);
my $name = gethostbyaddr $iaddr, AF_INET;

logmsg "connection from $name [", inet_ntoa($iaddr), "] at port $port";
print Client "Hello there, $name, it's now ", scalar localtime, "\n";
close Client;
}

CLIENT:


#!/usr/bin/perl -w

#
# A sample TCP client using Internet-domain sockets
#

require 5.002;
use strict;
use Socket;

my($remote, $port, $iaddr, $paddr, $proto, $line);

$remote = "localhost";
$port = 4500;

$iaddr = inet_aton($remote);
$paddr = sockaddr_in($port, $iaddr);

$proto = getprotobyname("tcp");
socket(S, PF_INET, SOCK_STREAM, $proto) || die "socket error: $!";
connect(S, $paddr) || die "connect error: $!";

while ( $line = <S> ) {

print $line;
}

close(S) || die "close error: $!";
Perfavore!!aiutatemi...