Re: How to perform a non-blocking synchronous ReadFile call/operation with NDISPROT ?
- From: "Skybuck Flying" <spam@xxxxxxxxxxx>
- Date: Tue, 23 May 2006 03:27:21 +0200
Yes most of the links provide lot's of information about synchronous and
asynchronous I/O.
However there is no mention of "non blocking" synchronous I/O.
The only thing which seems to be about "non blocking" synchronous I/O are
these lines of text:
"
When reading from a communications device, the behavior of ReadFile is
governed by the current communication time-out as set and retrieved by using
the SetCommTimeouts and GetCommTimeouts functions. Unpredictable results can
occur if you fail to set the time-out values. For more information about
communication time-outs, see COMMTIMEOUTS.
"
Bye,
Skybuck.
"Thomas F. Divine [DDK MVP]" <tdivine@xxxxxxxxxxxxxxxx> wrote in message
news:ejj2CYgfGHA.4464@xxxxxxxxxxxxxxxxxxxxxxx
Also, use the MSDN. A search for "ReadFile synchronous" brings up 500
topics (too broad a search...), BUT the first three in the list seem to
answer your question about how to perform synchronous/asynchronous I/O.
Thomas F. Divine, Windows DDK MVP
http://www.rawether.net
"Thomas F. Divine [DDK MVP]" <tdivine@xxxxxxxxxxxxxxxx> wrote in message
news:O1KK%23JgfGHA.3996@xxxxxxxxxxxxxxxxxxxxxxx
AFAIK the read will not complete until there is something to read. That's
the driver behavior. If you want a different behavior, then you will have
to modify the driver to suit your desires.
OTOH, your best bet is to start a thread that continuously performs reads
and queues the received packets (possibly throwing away unwanted ones).
You can examine the queued packets without blocking. Either there are
some to lookat - or there aren't.
The behavior is much like reading from a file (either synchronously or
asynchronously). If you make a ReadFile call, it won't complete until
you've read something.
Thomas F. Divine, Windows DDK MVP
"Skybuck Flying" <spam@xxxxxxxxxxx> wrote in message
news:447248ec$0$713$5fc3050@xxxxxxxxxxxxxxxxxxxxxxxxxxx
Hello,
My question is the same as the subject:
How to perform a non-blocking synchronous ReadFile call/operation with
NDISPROT ?
According to Microsoft's documentation ReadFile can be used for
synchronous and asynchronous operation.
However the ReadFile documentation doesn't really mention how to perform
the synchronous operation.
It also doesn't really mention that ReadFile is initially blocking ?
Because during testing it seems to block.
If it is in the documentation for ReadFile than I surely missed it.
The only thing which hints at synchronous operation is the
link/mention/reference to the COMMTIMEOUTS documentation.
This is probably more of a general windows programming topic. But still
who knows what quarks NDISPROT might have ;)
How are synchronous operation with ReadFile done generally ?
Am I supposed to set a timeout ?
Is that the way to go ?
If so... will NDISPROT return partial packets because of a timeout or
will it buffer packets and only return full/whole packets/frames ?
I don't want to use asynchronous calls for now because that interrupts
the code flow. I simply want my code to move on and not have to deal
with callbacks, event handlers etc.
Is there any other method to prevent the blocking in a simple way...
Maybe using select() ? Or something like that ? Because select() is
probably only a winsock function ? ;)
Select also works with a timeout if I am not mistaken so the first
method is probably more or less the same idea.
Bye,
Skybuck.
.
- Follow-Ups:
- Re: How to perform a non-blocking synchronous ReadFile call/operation with NDISPROT ?
- From: Maxim S. Shatskih
- Re: How to perform a non-blocking synchronous ReadFile call/operation with NDISPROT ?
- References:
- How to perform a non-blocking synchronous ReadFile call/operation with NDISPROT ?
- From: Skybuck Flying
- Re: How to perform a non-blocking synchronous ReadFile call/operation with NDISPROT ?
- From: Thomas F. Divine [DDK MVP]
- Re: How to perform a non-blocking synchronous ReadFile call/operation with NDISPROT ?
- From: Thomas F. Divine [DDK MVP]
- How to perform a non-blocking synchronous ReadFile call/operation with NDISPROT ?
- Prev by Date: Difference between synchronous and asynchronous operation/calls (NDISPROT)
- Next by Date: Re: WLAN Interface Monitoring and Control...
- Previous by thread: Re: How to perform a non-blocking synchronous ReadFile call/operation with NDISPROT ?
- Next by thread: Re: How to perform a non-blocking synchronous ReadFile call/operation with NDISPROT ?
- Index(es):
Relevant Pages
|