U++ framework
Do not panic. Ask here before giving up.

Home » U++ Library support » U++ MT-multithreading and servers » SocketEvent
Re: SocketEvent [message #13572 is a reply to message #10214] Tue, 15 January 2008 08:56 Go to previous messageGo to previous message
rylek is currently offline  rylek
Messages: 79
Registered: November 2005
Member
Hi there!

The trouble is, that instead of Unix / Linux, where the sockets are a built-in component of the OS and the file system, in Windows they are more like a hack glued to the OS by a few bits of adhesive tape. One of the implications of this is that you cannot mix socket and file handles, which you can freely do under Linux, another is that a socket handle, instead of a file handle, is not a valid object handle in the Windows sense to wait upon. So, wherever you need to do a

WaitForSingleObject

or a

MsgWaitForMultipleObjects

which includes a socket (typically in a web-enabled single-threaded GUI application you need to listen to sockets and check the message queue at the same time), you must create a proxy event. This is exactly what SocketEvent is for: you tell it to connect to a socket observing a certain socket action (or a combination thereof) and its event handle (inherited from the SyncObject class) can be then used in calls to the Wait functions. The WaitForSingleObject can be called via the SyncObject::Wait method. However, the multiple wait currently has no "elegant" wrapper in U++, you have to call it by yourself. I'll try to make for you a simple elegant example, the only real-life example I have is neither simple nor elegant and is not very likely to shed much light on this for you.

Regards

Tomas
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Thread based "conveyor" class for Win32
Next Topic: Socket functions calling order
Goto Forum:
  


Current Time: Sat Sep 12 02:24:48 GMT+2 2026

Total time taken to generate the page: 0.00539 seconds