$sock->send( "$msg\n" ); # possibly " $msg\r\n "
# or send a blank line
$sock->send( "\n" );
####
while(my $len = sysread( $sock, my $buffer, 1) > 0) { print "$buffer\n"; }
####
#!/usr/bin/perl
use warnings;
use strict;
my $sock = new IO::Socket::INET(
PeerAddr => $host,
PeerPort => $port,
Proto => 'tcp',
Reuse => 1
);
$sock->autoflush(1); # latest Sockets has this on by default
print $sock "log in information";
my $read_set = new IO::Select($sock);
my $incoming_data = "";
while (1) {
my @ready = $read_set->can_read(.5);
foreach my $rh (@ready) {
sysread ( $rh, my $line, 1024);
$incoming_data .= $line;
print "$incoming_data\n";
}
}