SOC_Socket

C Specification

#include <nitroWiFi/soc.h>
#define SOC_PF_INET      2   // ARPA Internet protocols

#define SOC_SOCK_STREAM  1   // stream socket
#define SOC_SOCK_DGRAM   2   // datagram socket
int SOC_Socket ( int pf, int type, int protocol );

Arguments

pf Specifies the protocol family of the socket to be created. For now, set pf to SOC_PF_INET (IPv4 Internet protocol).
type Specifies the type of socket to be created. Currently, SOC_SOCK_STREAM (TCP) and SOC_SOCK_DGRAM (UDP) are supported.
protocol Specifies the protocol to use with the socket. If protocol is 0, the default protocol for the specified protocol family and type is used. For now, set protocol to 0.

Return Values

0 or higher The new socket descriptor.
SOC_ENOMEM Insufficient memory.

Note: Additional errors may be generated and returned in future library releases. Please treat all negative return values as general errors.

Description

This function creates a socket that is not bound and returns the socket descriptor.

See Also

SOC_Close, SOC_Bind, SOC_Connect, SOC_Listen, SOC_Accept

Revision History

09/13/2005 Initial version.