Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
But I've got the following Problem:#! /opt/csw/bin/perl use warnings; use strict; use IO::Socket; use threads; sub doWork { my $conn = shift; my $thread = threads->self(); $thread->detach(); $| = 1; print $conn "enter your input: "; chomp(my $userInput = <$conn>); print $conn "got your input : $userInput\n"; $conn->close(); } my $sock = IO::Socket::INET->new(LocalPort => 14000, Listen => 20, ReuseAddr => 1, Proto => 'tcp', ); die "unable to create listening socket: $@" unless($sock); warn "listening...\n"; while(my $conn = $sock->accept()) { threads->create(\&doWork, $conn); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: accept on listening socket seems affected by threads->detach()
by zentara (Cardinal) on Jul 24, 2008 at 13:00 UTC | |
by Anonymous Monk on Jul 24, 2008 at 14:06 UTC | |
|
Re: accept on listening socket seems affected by threads->detach()
by perreal (Monk) on Jul 24, 2008 at 12:04 UTC | |
by Perlbotics (Archbishop) on Jul 24, 2008 at 12:14 UTC | |
by Anonymous Monk on Jul 24, 2008 at 14:01 UTC |