jgallagher has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl -w use strict; use IO::Socket; my $host = 'localhost'; my $port = 9000; my $client; my $listen = new IO::Socket::INET->new( Proto => 'tcp', LocalPort => $port, Reuse => 1, Listen => 5, ) or die "Can't start server"; while ($client = $listen->accept()) { open OUT, ">>/home/john/perl/daemonlog" or die "Can't open OUT: $! +\n"; while (<$client>) { chomp; print $client "Thank you for your command: $_\n"; print OUT $_; if ($_ eq "quit") { close OUT; close $client; } } } close $listen;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: File I/O while using Sockets?
by chromatic (Archbishop) on Nov 22, 2000 at 04:43 UTC | |
|
Re: File I/O while using Sockets?
by Fastolfe (Vicar) on Nov 22, 2000 at 04:44 UTC | |
by jgallagher (Pilgrim) on Nov 22, 2000 at 06:29 UTC | |
by Fastolfe (Vicar) on Nov 22, 2000 at 06:45 UTC | |
by extremely (Priest) on Nov 22, 2000 at 06:32 UTC | |
|
Re: File I/O while using Sockets?
by a (Friar) on Nov 26, 2000 at 02:48 UTC |