CASyncSocket::Socket
Allocates a socket handle.
BOOL Socket(
int nSocketType = SOCK_STREAM,
long lEvent = FD_READ | FD_WRITE | FD_OOB | FD_ACCEPT | FD_CONNECT | FD_CLOSE,
int nProtocolType = 0,
int nAddressFormat = PF_INET
);
Parameters
nSocketType
Specifies SOCK_STREAM or SOCK_DGRAM.lEvent
A bitmask that 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 of readiness for writing.
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 completed connection.
FD_CLOSE: Want to receive notification of socket closure.
nProtocolType
Protocol to be used with the socket that is specific to the indicated address family.nAddressFormat
Address family specification.
Return Value
Returns TRUE on success, FALSE on failure.
Remarks
This method allocates a socket handle. It does not call CAsyncSocket::Bind to bind the socket to a specified address, so you need to call Bind later to bind the socket to a specified address. You can use CAsyncSocket::SetSockOpt to set the socket option before it is bound.
Requirements
Header: afxsock.h