Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

cosecant's scratchpad

by cosecant (Monk)
on Oct 20, 2005 at 01:17 UTC ( [id://501494]=scratchpad: print w/replies, xml ) Need Help??

#! /usr/bin/perl #client for a basic sockets program use warnings; use Socket; socket(TO_SERVER, PF_INET, SOCK_STREAM, getprotobyname('tcp')); $inet_addr = inet_aton('localhost') or die("couldn't do it: $!"); $paddr = sockaddr_in('8080', $inet_addr); connect(TO_SERVER, $paddr) or die("Couln't connect: $!"); my $var = <STDIN>; print TO_SERVER $var; close(TO_SERVER);

#! /usr/bin/perl #server for a basic sockets program use warnings; use Socket; socket(SERVER, PF_INET, SOCK_STREAM, getprotobyname('tcp')); setsockopt(SERVER, SOL_SOCKET, SO_REUSEADDR, 1); my $my_addr=sockaddr_in('8080', INADDR_ANY); bind(SERVER, $my_addr) or die "Couldn't bind: $!\n"; listen(SERVER, SOMAXCONN) or die "Couldn't listen on port 8080: $!\n"; while (accept(CLIENT, SERVER)) { print "[Receiving incoming socket]\n"; print <CLIENT>; } close(SERVER);
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (1)
As of 2024-04-25 01:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found