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
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.