For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > November 2005 > Non-Blocking INET getline









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Non-Blocking INET getline
AOutaspace@freenet.de

2005-11-20, 3:56 am

Hi,

I have a Problem with blocking INET reading. I created a socket and wait
till a client connect to it. But no matter what I do, whenever I try to
read from the socket, it blocks. I tried $Client->blocking(0), but it
seems to have no effect. I tested it under Win2000 with Perl 5.6.1. Does
anyone kown how I can solve this problem?

Code:

$Socket = IO::Socket::INET->new(
LocalPort => '25022',
Proto => 'tcp',
Listen => 10,
Timeout => 1,
Type => SOCK_STREAM,
Reuse => 1
) or die $!;

until($Client = $Socket->accept()) {}


$Client->blocking(0);
# The next statment shouldnt block, but it does !!!
$Input = <$Client>;
$Client->blocking(1);

Later in the program I need the blocking. Has this anything to do with
Perl or Windows Version, I have problems with sockets under Win NT 4.0
too, but on the Client side ( but this is another story ).

Andre
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com