Thx. I realise I now also need to understand the GIL and locking it and unlocking it.
Does anyone know of any links where blocking I/O calls are demonstrated in pure python? I'm currently parsing the c code for _socket.pyd and reading up on Py_BEGIN_ALLOW_THREADS and Py_END_ALLOW_THREADS. My goal is basically to produce a high performance socket that I can use with a Windows UI (wxpython) - so was thinking of calling ws2_32.dll but it looks like I might need to be a bit more careful. Any comments / pointers / help appreciated. David -----Original Message----- From: python-win32-bounces+david.briant=ubs....@python.org [mailto:python-win32-bounces+david.briant=ubs....@python.org] On Behalf Of Tim Roberts Sent: Wed 5-Jan-2011 22:36 To: Python-Win32 List Subject: Re: [python-win32] WSAAsyncSelect david.bri...@ubs.com wrote: > > I'm looking for a little help on using WSAAsyncSelect via ctypes.I > imagine this has been asked before but I couldn't figure out how to > search the archives (and trawling through them randomly didn't really > help). > > ...Would it be something likethe following? > > winsock = ctypes.windll.ws2_32 > > WM_MY_SOCKET_MESSAGE= WM_USER + 1 > > ... > > s =12345 > > hWnd = 1234 > > wMsg = WM_MY_SOCKET_MESSAGE > > lEvent =FD_READ|FD_WRITE|FD_ACCEPT|FD_CONNECT|FD_CLOSE > > socketErrorOrZero = winsock.WSAAsyncSelect(s, hWnd, wMsg, lEvent) > Yes, indeed. I think that sock.socket.fileno should get you the socket handle for the first parameter. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. _______________________________________________ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32 Visit our website at http://www.ubs.com This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mails are not encrypted and cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. This message is provided for informational purposes and should not be construed as a solicitation or offer to buy or sell any securities or related financial instruments. UBS Limited is a company limited by shares incorporated in the United Kingdom registered in England and Wales with number 2035362. Registered office: 1 Finsbury Avenue, London EC2M 2PP. UBS Limited is authorised and regulated by the Financial Services Authority. UBS AG is a public company incorporated with limited liability in Switzerland domiciled in the Canton of Basel-City and the Canton of Zurich respectively registered at the Commercial Registry offices in those Cantons with Identification No: CH-270.3.004.646-4 and having respective head offices at Aeschenvorstadt 1, 4051 Basel and Bahnhofstrasse 45, 8001 Zurich, Switzerland. Registered in the United Kingdom as a foreign company with No: FC021146 and having a UK Establishment registered at Companies House, Cardiff, with No: BR 004507. The principal office of UK Establishment: 1 Finsbury Avenue, London EC2M 2PP. In the United Kingdom, UBS AG is authorised and regulated by the Financial Services Authority. UBS reserves the right to retain all messages. Messages are protected and accessed only in legally justified cases. _______________________________________________ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32