Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I'm trying to use IO::Socket but seem to be running into trouble. I want to read the request and headers and then print out the appropriate page
I try connecting with my web browser to the machine on the correct port but the server never seems to take any of the action within the while loop.use strict; use IO::Socket; my $server = IO::Socket::INET->new ( Proto => "tcp", LocalPort => 3000, Reuse=>1, Listen=>10 ) or die "Cannot connect to time service"; my ($request,$remote); $server->autoflush (1); while (defined($remote=$server->accept())) { $remote->autoflush(1); $request=<$remote>; print $request."\n"; }
Any help would be most appreciated.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How do I write a simple webserver
by lhoward (Vicar) on Sep 18, 2000 at 06:26 UTC | |
|
Re: How do I write a simple webserver
by merlyn (Sage) on Sep 18, 2000 at 06:24 UTC | |
|
RE: How do I write a simple webserver
by Zarathustra (Beadle) on Sep 18, 2000 at 09:02 UTC | |
by tye (Sage) on Sep 18, 2000 at 09:16 UTC |