L
Larry
Hello everybody,
I don't know if this has been covered before, I'd love to code a
tiny server that can hanlde several requests at the same...the following
chuck of code can only handle one connection at a time:
use Socket qwDEFAULT :crlf);
$socket = IO::Socket::INET->new() || die "unableto listen";
$socket->listen();
$| = 1;
while (1)
{
$client = $socket->accept;
if ($client)
{
...get data...send response...
close $client;
}
}
How can I go about using fork() ? it's just a tiny server so a couple of
connections at the same time would be good...
thanks
I don't know if this has been covered before, I'd love to code a
tiny server that can hanlde several requests at the same...the following
chuck of code can only handle one connection at a time:
use Socket qwDEFAULT :crlf);
$socket = IO::Socket::INET->new() || die "unableto listen";
$socket->listen();
$| = 1;
while (1)
{
$client = $socket->accept;
if ($client)
{
...get data...send response...
close $client;
}
}
How can I go about using fork() ? it's just a tiny server so a couple of
connections at the same time would be good...
thanks