Re: Non-blocking input on windows, like select in Unix

From: Jonathan Fine (jfine_at_pytex.org)
Date: 03/02/05


Date: Wed, 02 Mar 2005 18:52:26 +0000

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


Relevant Pages

  • [Full-disclosure] Defense in depth -- the Microsoft way (part 14): incomplete, misleadin
    ... | lpApplicationName to cmd.exe and set lpCommandLine to the following ... calls CreateProcess*() is located) instead of the expected %COMSPEC% ... The 32-bit Windows system directory. ... The 'application directory' of Windows Explorer is %SystemRoot%, ...
    (Full-Disclosure)
  • Defense in depth -- the Microsoft way (part 14): incomplete, misleading and dangerous docume
    ... | lpApplicationName to cmd.exe and set lpCommandLine to the following ... calls CreateProcess*() is located) instead of the expected %COMSPEC% ... The 32-bit Windows system directory. ... The 'application directory' of Windows Explorer is %SystemRoot%, ...
    (Bugtraq)
  • Screen flash when using cl.exe
    ... same bug exists with Microsoft's cl.exe compiler. ... I request that it be replaced with CreateProcess. ... When Windows starts a subprocess, it will try and attach it to a console unless ...
    (microsoft.public.dotnet.languages.vc)
  • RE: acquiring standard out, standard error
    ... technologies using in Windows Service: ... that the parent process passed the redirected pipe handles in CreateProcess ... redirect the child process's standard output/input. ... Microsoft Online Community Support ...
    (microsoft.public.dotnet.framework)
  • Re: How to run a program silently with CreateProcessWithLogonW()?
    ... > Well, I did made it when I used CreateProcess, the same setting does not ... > I am working on Windows Server 2003. ... a new console window appears. ... direct or with the comspec? ...
    (microsoft.public.win32.programmer.kernel)