Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: How do I get started (reading data from a socket)

by marcos (Scribe)
on May 02, 2000 at 15:03 UTC ( [id://9921]=note: print w/replies, xml ) Need Help??


in reply to How do I get started (reading data from a socket)

I use the <> operator to read data from a socket:
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;

marcos

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://9921]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2024-03-19 05:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found