The SockSocket() call creates an end point for communication and returns a socket descriptor representing the end point. Each socket type provides a different communication service.
Syntax:
>>--SockSocket(domain, type, protocol)-----------------------------------><
where:
is the communication domain requested. It specifies the protocol family to be used. Currently, only the domain AF_INET is supported, which uses addresses in the Internet address format.
is the type of socket created. The following types are supported:
provides sequenced, two-way byte streams that are reliable and connection-oriented. It supports a mechanism for out-of-band data. Stream sockets are supported by the Internet (AF_INET) communication domain.
provides datagrams, which are connectionless messages of a fixed length whose reliability is not guaranteed. Datagrams can be received out of order, lost, or delivered several times. Datagram sockets are supported by the Internet (AF_INET) communication domain.
provides the interface to internal protocols, such as IP and ICMP. Raw sockets are supported by the Internet (AF_INET) communication domain.
is the protocol to be used with the socket. It can be IPPROTO_UDP, IPPROTO_TCP, or 0. If it is set to 0, which is the default, the system selects the default protocol number for the domain and socket type requested.
Sockets are deallocated with the SockClose() call.
Return values:
A non-negative socket descriptor return value indicates successful execution of the call. The return value -1 indicates an error. You can get the specific error code SockSock_Errno() or SockPSock_Errno(). Possible values are:
The maximum number of sockets are currently in use.
The protocol is not supported in the specified domain or the protocol is not supported for the specified socket type.
The protocol family is not supported.
The socket type is not supported.
Note: SockSocket() interfaces with the C function socket().