Non-blocking input on windows, like select in Unix

Jonathan Fine jfine at pytex.org
Wed Mar 2 13:52:26 EST 2005


fraca7 wrote:
> Jonathan Fine a écrit :
> 
>> Paul Rubin wrote:
> 
> 
>> As I recall, some posts to this list say that Windows provides
>> non-blocking i/o for sockets but not for files.
> 
> 
> No, Windows does provide non-blocking I/O for regular files, but it's a 
> completely different mechanism than the one used by winsock. You'll have 
> to use win32all and enter the Dark Side, that is Windows APIs.
> 
> You don't want to do that if you're not already familiar with 
> CreateProcess, CreatePipe, overlapped structures, WaitForSingleObject & 
> al...


Thank you for this.

My application will, I think, become much more complicated if I cannot
use non-blocking input.  (As already explained, it is not a problem
that can be solved by threads.  Basically, I _need_  either to read
all available data, _or_ to read very carefully a byte at a time.)

Knowing that non-blocking input can be done under Windows, I would
like to use it.  In the longer run, that will be easier than
rewriting my application.  Or so it seems to me.

I did a google search, on the web, for
   CreateProcess, CreatePipe, overlapped structures, WaitForSingleObject

This is the first page is produced
   http://www.codeproject.com/threads/anonpipe1.asp

Seems to be the right sort of thing.  But I don't have time to read it
now.

I'm not really a Windows programmer.  Don't know the system calls.

But I do want my application to run on Windows.

I'll get back to this in a couple of weeks.  (Busy right now.)


-- 
Jonathan




More information about the Python-list mailing list