TCPIP_TCP_Bind Function
C
bool TCPIP_TCP_Bind(
TCP_SOCKET hTCP,
IP_ADDRESS_TYPE addType,
TCP_PORT localPort,
IP_MULTI_ADDRESS* localAddress
);
Description
This function is meant for unconnected server and client sockets. It is similar to TCPIP_TCP_SocketNetSet that assigns a specific source interface for a socket. If localPort is 0 the stack will assign a unique local port. Sockets don't need specific binding, it is done automatically by the stack. However, specific binding can be requested using these functions. Works for both client and server sockets.
Preconditions
TCP socket should have been opened with TCPIP_TCP_ServerOpen()/TCPIP_TCP_ClientOpen(). hTCP - valid socket.
Parameters
Parameters | Description |
---|---|
hTCP | Socket to bind. |
addType | The type of address being used. Example: IP_ADDRESS_TYPE_IPV4/IP_ADDRESS_TYPE_IPV6. |
localPort | local port to use. If 0, the stack will assign a unitue local port. |
localAddress | The local address to bind to. Could be NULL if the local address does not need to be changed. |
Returns
True - Indicates success.
False - Indicates failure.
Remarks
The call will fail if the socket is already connected (both server and client sockets).