use IO::Socket;
$sock = new IO::Socket::INET (
PeerAddr => '141.121.85.63',
PeerPort => '64511',
Proto => 'tcp',
Listen => SOMAXCONN,
Reuse => 1,
);
die "Could not create socket: $!\n" unless $sock;
print $sock
$new_sock = $sock->accept();
while(<$new_sock>) {
print "!99200test@@";
}
close($sock);
The problem is that you're specifying a PeerAddr (client socket) and Listen (server socket). Drop Listen and accept.
use IO::Socket::INET (); my $sock = IO::Socket::INET->new( Proto => 'tcp', PeerAddr => '141.121.85.63', PeerPort => '64511', ) or die "Unable to create socket: $!\n"; print while <$sock>;
By the way, when on PerlMonks, please put your code, messages, etc inside of
perlmonks.org content © perlmonks.org and hohumbgdl2003, ikegami
prlmnks.org © 2006 edmund von der burg (eccles & toad)
v 0.03