CCeSocket
This class is derived from the CSocket class. If you want to use asynchronous communication in Windows CE, you must use the CCeSocket class. Windows CE does not inherently support asynchronous socket communication, but the CCeSocket class provides asynchronous notification for the following types of socket events:
- Notification that the socket is ready to read (FD_READ)
- Notification of incoming connections (FD_ACCEPT)
- Notification of completed connections (FD_CONNECT)
Remarks
Use the CCeSocket class, or a class derived from CCeSocket, for Windows CE applications, rather than using CSocket or CAsyncSocket.
The CSocket and CAsyncSocket classes rely on the standard Windows message-based notification of network events, but Windows CE does not support asynchronous event notification. Without access to asynchronous event notification, an application must poll for network events that it wishes to handle. This is inefficient. The CCeSocket class achieves the effect of asynchronous event notification by creating two threads that monitor socket events. When a thread detects one of the three events for which the CCeSocket class provides notifications, it sends a message to the appropriate handler. All instances of CCeSocket share the same two monitor threads.
MFC for Windows CE supports a global function and a window message that you can use in conjunction with the CCeSocket class. Use the WM_SOCKET_NOTIFY message in a Windows CE application to notify a socket of an asynchronous event; for example, when the socket to which it is connected is closing. The WM_SOCKET_NOTIFY message is processed by a socket window that is maintained as part of the thread state of the module. Use the AfxGetCeSocketWindow function to obtain the handle to this window.
Requirements
Windows CE versions: 2.0 and later
Header file: Declared in Wcesock.h
Platform: H/PC Pro, Palm-size PC, Pocket PC
See Also
CArchive, CAsyncSocket, CSocketFile, Unique MFC Classes for Windows CE