Bugs item #1398756, was opened at 2006-01-06 18:47
Message generated for change (Comment added) made by ghazel
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=551954&aid=1398756&group_id=78018
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: win32
Group: None
Status: Closed
Resolution: Wont Fix
Priority: 5
Submitted By: Greg Hazel (ghazel)
Assigned to: Nobody/Anonymous (nobody)
Summary: ReadFile returns trash when using overlapped io on namedpipe
Initial Comment:
This bug demonstration probably looks familiar if you
read svcbug.py - however it is a different bug.
win32file.ReadFile seems to be returning as much data
as is requested (only when using overlapped io) even
if that much data is not actually available. The extra
data is random trash. This same operation in C does
not act this way.
running "ovbug.py s" starts a correct server
and "ovbug.py s bug" starts a buggy server.
running "ovbug.py c" starts a client
You'll also notice that PeekNamedPipe seems to
indicate the correct situation.
----------------------------------------------------------------------
>Comment By: Greg Hazel (ghazel)
Date: 2006-01-18 19:17
Message:
Logged In: YES
user_id=731668
Ah, I skipped over the fact that it was passing in the same
buffer each time.
The win32file.ReadFile behaviour makes sense to me now,
thanks.
----------------------------------------------------------------------
Comment By: Mark Hammond (mhammond)
Date: 2006-01-10 22:22
Message:
Logged In: YES
user_id=14198
It appears that sample uses strlen() to determine how much
to write.
I'm not sure what you are asking for. ReadFile simply
returns the exact same buffer that was passed to it. If you
were writing this in C and passing (say) an 8k buffer to the
function, there must be *some* way to determine how much of
that is valid. My choice was to put that in the hands of
the programmer.
----------------------------------------------------------------------
Comment By: Greg Hazel (ghazel)
Date: 2006-01-10 17:55
Message:
Logged In: YES
user_id=731668
Why does this work differently form the native win32 api?
This example doesn't use the overlapped api to retrieve the
size of the valid data:
http://msdn.microsoft.com/library/default.asp?
url=/library/en-
us/ipc/base/named_pipe_server_using_overlapped_i_o.asp
----------------------------------------------------------------------
Comment By: Mark Hammond (mhammond)
Date: 2006-01-10 05:16
Message:
Logged In: YES
user_id=14198
This is the documented behaviour. From the pywin32 docs for
ReadFile:
While the operation is in progress, you can use the slice
operations (object[:end]) to obtain the data read so far.
You must use the OVERLAPPED API functions to determine how
much of the data is valid.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=551954&aid=1398756&group_id=78018
|