metalgear119 has asked for the wisdom of the Perl Monks concerning the following question:

Does anybody know how to read input from a socket and not have it block? I'm using Active State Perl for windows, and the nonblock function doesn't seem to work. I'd prefer and not use a selector because it doesn't seem to work for the actual connection after an accept has been done.
  • Comment on Nonblocking Sockets in Active State Perl

Replies are listed 'Best First'.
Re: Nonblocking Sockets in Active State Perl
by 5mi11er (Deacon) on Apr 22, 2005 at 14:55 UTC
    I don't think you can do non-blocking "stuff" without select. I would venture to guess when you tried to use select, you probably weren't using it entirely correctly.

    We would probably be able to help more if you post what you tried with select and explain what happens with that code that fails to work for you.

    -Scott

Re: Nonblocking Sockets in Active State Perl
by Anonymous Monk on Apr 22, 2005 at 18:53 UTC
Re: Nonblocking Sockets in Active State Perl
by Forsaken (Friar) on Apr 22, 2005 at 15:16 UTC
    the proper command for a non-blocking socket read would be sysread(). there's a little more to it than that though, could you elaborate on what you're trying to do?

    Remember rule one...
Re: Nonblocking Sockets in Active State Perl
by salva (Canon) on Apr 22, 2005 at 15:20 UTC
    A long time ago (well, maybe 2 years ago), I found that on Windows, openining a connection always blocks, but then, reading and writing doesn't.

    Unfortunately, I didn't investigate it further and could not asure it wasn't actually a bug on my code :-(