CAsyncSocket::Bind

This member function associates a local address with the socket. 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.

Syntax

BOOL Bind( UINT nSocketPort, LPCTSTR lpszSocketAddress = NULL );

BOOL Bind ( const SOCKADDR* lpSockAddr, int nSockAddrLen );

At a Glance

Header file: Afxsock.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CAsyncSocket Overview, CAsyncSocket Member Functions, Windows Sockets Classes, CAsyncSocket::Connect, CAsyncSocket::Listen, CAsyncSocket::GetSockName, CAsyncSocket::SetSockOpt, CAsyncSocket::Create