Embedded TCP/IP stack: fnet_socket_bind

FNET

Embedded TCP/IP stack  4.1.0
fnet_return_t fnet_socket_bind ( fnet_socket_t  s,
const struct fnet_sockaddr name,
fnet_size_t  namelen 
)

Assigns a local address to a socket.

Parameters
sDescriptor, identifying a socket to bind.
nameThe address to be assigned to the socket, from the fnet_sockaddr structure.
namelenThe length of the name parameter. Normally namelen is set to sizeof(name).
Returns
This function returns:
See also
fnet_socket()

This function associates a local address with the socket.
The fnet_socket_bind() function is used on an unconnected socket before subsequent calls to the fnet_socket_connect() or the fnet_socket_listen() functions. It is used to bind to either connection-oriented (stream) or connectionless (datagram) sockets.
Within the fnet_sockaddr structure, the address may be the address assigned to a network interface on the host or the INADDR_ANY. Using the INADDR_ANY causes the stack to use the default network interface address. Using a port number of 0 causes the service provider to assign a unique ephemeral port number to the socket with a value between 49152 to 65535 (sugested by IANA)


© 2005-2018 by Andrey Butok. http://fnet.sourceforge.net