in reply to Recieving reply from a socket
First thing first, your code won't even compile in its present state. Also, always use strict and use warnings.
Reworked and compiling code:
use strict; use warnings; use IO::Socket::INET; my $socket = IO::Socket::INET->new(PeerAddr => "localhost", PeerPort => 12323, Proto => 'tcp'); print $socket "Hi!"; print $socket "Aha, I see!"; $socket->close();
To read the replies, all you really need to do is read from the socket like any other file handle. You can use recv, or, more simply, my $response = <$socket>.
And just because it is a common issue, you might want to take a look at Suffering From Buffering.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Recieving reply from a socket
by Anonymous Monk on Mar 19, 2009 at 15:14 UTC | |
by Anonymous Monk on Mar 19, 2009 at 15:31 UTC | |
by Anonymous Monk on Mar 19, 2009 at 15:41 UTC | |
by lostjimmy (Chaplain) on Mar 19, 2009 at 15:58 UTC | |
by Anonymous Monk on Mar 19, 2009 at 15:45 UTC |