BOOL Create( UINT nSocketPort = 0, int nSocketType = SOCK_STREAM, long lEvent = FD_READ | FD_WRITE | FD_OOB | FD_ACCEPT | FD_CONNECT | FD_CLOSE, LPCTSTR lpszSocketAddress = NULL );
Return Value
Nonzero if the function is successful; otherwise 0, and a specific error code can be retrieved by calling GetLastError. The following errors apply to this member function:
Parameters
nSocketPort
A well-known port to be used with the socket, or 0 if you want Windows Sockets to select a port.
nSocketType
SOCK_STREAM or SOCK_DGRAM.
lEvent
A bitmask which specifies a combination of network events in which the application is interested.
lpszSockAddress
A pointer to a string containing the network address of the connected socket, a dotted number such as "128.56.22.8".
Remarks
Call the Create member function after constructing a socket object to create the Windows socket and attach it. Create then calls Bind to bind the socket to the specified address. The following socket types are supported:
Note The Accept member function takes a reference to a new, empty CSocket object as its parameter. You must construct this object before you call Accept. Keep in mind that if this socket object goes out of scope, the connection closes. Do not call Create for this new socket object.
For more information about stream and datagram sockets, see the articles Windows Sockets: Background and Windows Sockets: Ports and Socket Addresses in Visual C++ Programmer's Guide and Overview of Windows Sockets 2 and Windows Sockets Programming Considerations in the Win32 SDK documentation.
CAsyncSocket Overview | Class Members | Hierarchy Chart
See Also CAsyncSocket::Accept, CAsyncSocket::Bind, CAsyncSocket::Connect, CAsyncSocket::GetSockName,CAsyncSocket::IOCtl, CAsyncSocket::Listen, CAsyncSocket::Receive, CAsyncSocket::Send, CAsyncSocket::ShutDown