self._ecb = ecb
if self._ecb.AvailableBytes > 0:
data = self._ecb.AvailableData
# Check if more data from client than what is in
# ecb.AvailableData
excess = self._ecb.TotalBytes - self._ecb.AvailableBytes
if excess > 0:
extra = self._ecb.ReadClient(excess)
data = data + extra
self._in.write(data)
# rewind to start
self._in.seek(0)
Morale of story: win32 extension docs are light, due to it being a Python wrapper around the Windows API, and you need to read the Microsoft docs to get all the info.
Now just need to find some Microsoft docs that I can understand about Windows completion ports. Then I can start work on the threaded extension.
The simple ISAPI-WSGI handler seems to be working. Need to create some unit tests to exercise it.
CATEGORY:PYTHON
2 comments:
This turned to be very useful post indeed.
Thanks for figuring that out! :)
If you'd like to skip the Microsoft-specific parts, like ReadClient, check out PyISAPIe. It's a little less muddled and doesn't really require any win32 API specifics.
http://pyisapie.sourceforge.net/
Post a Comment