473,396 Members | 2,068 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

[win32all] GetQueuedCompletionStatus Problem

'''############################################### ##########################
GetQueuedCompletionStatus is return new OVERLAPPED instaed requested
OVERLAPPED. And OVERLAPPED.object member is lost.
and WSARecv Function increase Memory
Any clues anyone?

show test code
################################################## #######################'''

import win32file, win32event
import pywintypes
import socket

iocp = win32file.CreateIoCompletionPort(win32file.INVALID _HANDLE_VALUE,
None, 0, 0)

listen_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
listen_socket.setblocking(0)
listen_socket.bind(('localhost', 9999))
listen_socket.listen(5)

accept_ol = pywintypes.OVERLAPPED()
accept_ol.object = "ACCEPT"
print 'accept_ol', accept_ol, accept_ol.object

accept_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
accept_socket.setblocking(0)
accept_buf = win32file.AllocateReadBuffer(64)
win32file.AcceptEx( listen_socket, accept_socket, accept_buf,
accept_ol)

win32file.CreateIoCompletionPort(listen_socket.fil eno(), iocp, 0, 0)
rc = 0
print 'listen loop'
while rc != 1:
(rc, nbytes, key, ol) = win32file.GetQueuedCompletionStatus(iocp,
win32event.INFINITE)
print 'GQCS --> ', rc, nbytes, key, ol, 'object:', getattr(ol,
'object', None)

recv_ol = pywintypes.OVERLAPPED()
recv_ol.object = "RECV"
print 'recv_ol', recv_ol, recv_ol.object

recv_buf = win32file.AllocateReadBuffer(1024)

win32file.CreateIoCompletionPort(accept_socket.fil eno(), iocp, 0, 0)
#win32file.WSARecv( accept_socket, recv_buf, recv_ol)
win32file.ReadFile( accept_socket.fileno(), recv_buf, recv_ol)

while 1:
(rc, nbytes, key, ol) = win32file.GetQueuedCompletionStatus(iocp,
win32event.INFINITE)
print 'GQCS --> ', rc, nbytes, key, ol, 'object:', getattr(ol,
'object', None)

# print recv_buf[:nbytes]
if (rc == 1):
# win32file.WSARecv( accept_socket, recv_buf, recv_ol)
win32file.ReadFile( accept_socket.fileno(), recv_buf, recv_ol)

'''############################################### ##########################
result

accept_ol <PyOVERLAPPED object at 0x00886F60> ACCEPT
listen loop
GQCS --> 1 0 0 <PyOVERLAPPED object at 0x009022B8> object: None
recv_ol <PyOVERLAPPED object at 0x009A1520> RECV
GQCS --> 1 1024 0 <PyOVERLAPPED object at 0x009A1550> object: None
GQCS --> 1 1024 0 <PyOVERLAPPED object at 0x009022B8> object: None
GQCS --> 1 1024 0 <PyOVERLAPPED object at 0x009A1550> object: None
GQCS --> 1 1024 0 <PyOVERLAPPED object at 0x009022B8> object: None
GQCS --> 1 1024 0 <PyOVERLAPPED object at 0x009A1550> object: None
GQCS --> 1 1024 0 <PyOVERLAPPED object at 0x009022B8> object: None
GQCS --> 1 1024 0 <PyOVERLAPPED object at 0x009A1550> object: None
GQCS --> 1 1024 0 <PyOVERLAPPED object at 0x009022B8> object: None
GQCS --> 1 1024 0 <PyOVERLAPPED object at 0x009A1550> object: None
GQCS --> 1 1024 0 <PyOVERLAPPED object at 0x009022B8> object: None
GQCS --> 64 0 0 <PyOVERLAPPED object at 0x009022B8> object: None

################################################## #######################'''
Jul 18 '05 #1
0 1212

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: gcash | last post by:
OK, I was writing code using WIN32ALL to do automation scripts for common things we do in IE a lot at work, since grunt-n-point gets very boring after a while. I snarfed the code from ...
0
by: Steve Zatz | last post by:
I understand that there was a problem with win32pdh.EnumObjectItems under Windows XP but that recent versions of win32all corrected the problem. I installed win32all build 156 (Python 2.2.3) and...
0
by: Mike Cannon | last post by:
I'm having a problem with the newer version of win32all and Python 2.3 with code that works fine on Python-2.2 (details below). Both machines are Windows XP. The code that breaks is derived...
0
by: The Jetman | last post by:
Folks: Have seen this minor problem w/ WIN32ALL-157 thru 159. I install a fresh copy of Python 2.3. Then proceed to install WIN32ALL. It always crashes the 1st time thru w/ the following dump...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.