use strict; use IO::Socket; my $host = 'myhost.mysite.org'; my $port = 7530; my $sock = new IO::Socket::INET(PeerAddr => $host, PeerPort => $port, Proto => 'tcp'); die "cannot open socket" unless ($sock); #send a command to the server my $cmd = "MYGET\n"; print $sock $cmd; # print server response while (<$sock>) { print; } close $sock;
In reply to Re: How do I get started (reading data from a socket)
by marcos
in thread How do I get started (reading data from a socket)
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |