Embedded TCP/IP stack: fnet_socket

FNET

Embedded TCP/IP stack  4.1.0
fnet_socket_t fnet_socket ( fnet_address_family_t  family,
fnet_socket_type_t  type,
fnet_uint32_t  protocol 
)

Creates a socket.

Parameters
familyAddress family that the socket will use, defined by the fnet_address_family_t.
typeType specification for the new socket, defined by fnet_socket_type_t. It can be SOCK_STREAM (TCP) or SOCK_DGRAM (UDP).
protocolProtocol to be used with the socket that is specific to the indicated address family. This stack supports IPPROTO_TCP and IPPROTO_UDP.
This parameter is optional, and can be set to zero, as the type already defines the proper protocol.
Returns
This function returns:
  • Socket descriptor referencing the new socket, if no error occurs.
  • FNET_NULL if an error occurs.
    The specific error code can be retrieved using the fnet_error_get().
See also
fnet_socket_close()

This function creates a socket and returns its descriptor.
The fnet_socket() function causes a socket descriptor and any related resources to be allocated and bound to a specific transport-service provider that supports the requested combination of address family, socket type, and protocol parameters.

After a socket is created:


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