> OK, you owe me a beer :~) Note that this has zilch security or anything to > prevent DoS type attacks, so caveat emptor... Should I send the ups red label ;)
> > server.pl > --------- > #!/usr/bin/perl > > use strict; > use IO::Socket::INET; > > my $n = 0; > > my $sock = IO::Socket::INET->new( > LocalPort => 12000, > Proto => 'tcp', > Listen => 5) > or die "Couldn't create listen socket: $!"; > > warn "Waiting for connections\n"; > while (my $client = $sock->accept) { > $n++; > defined(my $pid = fork) or die "Couldn't fork: $!"; > next if $pid; > > my $host = $client->peerhost; > my $file = "file.$n"; > warn "Received connection from $host, writing to $file\n"; > open F, ">$file"; > print F while <$client>; > close F; > warn "Connection from $host closed\n"; > exit; > } > > client.pl > --------- > #!/usr/bin/perl > > use strict; > use IO::Socket::INET; > > my $n = 0; > > @ARGV or die "usage: $0 host [port]\n"; > my $host = shift; > my $port = shift || 12000; > > my $sock = IO::Socket::INET->new( > PeerAddr => $host, > PeerPort => $port, > Proto => 'tcp') > or die "Couldn't connect to $host:$port: $!"; > > print $sock $_ while <>; Perfect Thanks!! As far as security and such I can build it back in later in the week when I finish the network book. Thanks a bunch!! Paul -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>