http://qs1969.pair.com?node_id=395564

HumanProgrammer has asked for the wisdom of the Perl Monks concerning the following question:

Hello! Here is my perl script. I tried to communicate on the same port, but it wasn't worked. I can send message to a server, but I cannot get any response. The response is sent out from the server in the 30000 port - I tested the server with a C++ client and the same scenario worked fine.
#! /usr/bin/perl use IO::Socket::INET; my $sock = new IO::Socket::INET ( PeerAddr => '127.0.0.1', PeerPort => '30000', Proto => 'tcp', ); die "Could not create socket: $!\n" unless $sock; print $sock "Hello there!\n"; my $new_sock = $sock->accept(); while(defined(<$sockin>)) { print "Arrived?\n"; print $_; } print "Stopped! \n"; close($sock);
Maybe this line is wrong: my $new_sock = $sock->accept(); What other lib should I use? How could I fix it?

Br, HP

Edit by tye, remove PRE tag, preserve formatting