BOOL Bind( UINT nSocketPort, LPCTSTR lpszSocketAddress = NULL );
BOOL Bind ( const SOCKADDR* lpSockAddr, int nSockAddrLen );
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
The port identifying the socket application.
lpszSocketAddress
The network address, a dotted number such as “128.56.22.8”.
lpSockAddr
A pointer to a SOCKADDR structure that contains the address to assign to this socket.
nSockAddrLen
The length of the address in lpSockAddr in bytes.
Remarks
Call this member function to associate a local address with the socket. This routine is used on an unconnected datagram or stream socket, before subsequent Connect or Listen calls. Before it can accept connection requests, a listening server socket must select a port number and make it known to Windows Sockets by calling Bind. Bind establishes the local association (host address/port number) of the socket by assigning a local name to an unnamed socket.
CAsyncSocket Overview | Class Members | Hierarchy Chart
See Also CAsyncSocket::Connect, CAsyncSocket::Listen, CAsyncSocket::GetSockName, CAsyncSocket::SetSockOpt, CAsyncSocket::Create