TCP/IP Programming Manual
C Synopsis
#include <socket.h>
#include <netdb.h>
socket_file_number = socket (address_family, socket_type,
protocol);
socket_file_number = socket_nw (address_family,socket_type,
protocol, flags, sync);
int socket_file_number, address_family, socket_type,
protocol, flags, sync;
TAL Synopsis
?NOLIST, SOURCE SOCKDEFT
?NOLIST, SOURCE SOCKPROC
socket_file_number := socket (address_family, socket_type,
protocol);
socket_file_number := socket_nw (address_family,socket_type,
protocol, flags, sync);
INT socket_file_number,
address_family,
socket_type,
protocol,
flags,
sync;
socket_file_number
return value; the socket number for the newly created socket. If the call is not successful –1 is
returned, and the external variable errno is set as indicated in Errors (page 193).
address_family
input value; specifies the address format. The value given for this parameter must be AF_INET
for NonStop TCP/IP and Parallel Library TCP/IP but can be either AF_INET or AF_INET6 for
NonStop TCP/IP.
socket_type
input value; specifies the semantics of communication. It must be one of the following values:
Create a TCP socket.SOCK_STREAM
Create a non-fault-tolerant socket.SOCK_STREAM_NONFT
Create a UDP socket.SOCK_DGRAM
Create a raw socket for access to the raw IP protocol level. To create a raw socket, the
process access ID of the requesting application must be in the SUPER group (user ID
255,nnn).
SOCK_RAW
protocol
input value; the specific IP number. This parameter must be specified if socket_type is
SOCK_RAW; it is ignored if socket_type is SOCK_STREAM or SOCK_DGRAM.
If socket_type is SOCK_RAW, the value of protocol cannot be the number assigned to
ICMP (1), TCP (6), or UDP (17). The application must provide support for the specified protocol.
flags
input value; specified in the format of the flags parameter for the deprecated OPEN_()
procedure, as described in the Guardian Procedure Errors and Messages Manual.
192 Library Routines