Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

CAsyncSocket::Attach 

Call this member function to attach the hSocket handle to an CAsyncSocket object.


BOOL Attach(
   SOCKET hSocket,
      long lEvent = FD_READ | FD_WRITE | FD_OOB | FD_ACCEPT | FD_CONNECT | FD_CLOSE 
);

Parameters

hSocket

Contains a handle to a socket.

lEvent

A bitmask which specifies a combination of network events in which the application is interested.

  • FD_READ   Want to receive notification of readiness for reading.

  • FD_WRITE   Want to receive notification when data is available to be read.

  • FD_OOB   Want to receive notification of the arrival of out-of-band data.

  • FD_ACCEPT   Want to receive notification of incoming connections.

  • FD_CONNECT   Want to receive notification of connection results.

  • FD_CLOSE   Want to receive notification when a socket has been closed by a peer.

Nonzero if the function is successful.

The SOCKET handle is stored in the object's m_hSocket data member.

Community Additions

ADD
Show:
© 2015 Microsoft