socket.2 (2010 09)

s
socket(2) socket(2)
used if the socket type is SOCK_STREAM. UDP is used if the socket type is SOCK_DGRAM. In both
cases, Internet protocol (IP) and the X.25-to-IP interface module are used.
If the socket is in the AF_CCITT address family, only the SOCK_STREAM socket type is supported.
Refer to the topic "Comparing X.25 Level 3 Access to IP" in the X.25 Programmer’s Guide for more details
on the difference between programmatic access to X.25 via IP and X.25 Level 3.
If the socket is in the AF_CCITT family, the connection and all other operations pass data directly from
the application to the X.25 Packet Level (level 3) without passing through a TCP or UDP protocol. Con-
nections of the AF_CCITT family cannot use most of the socket level options described in getsockopt (2).
However, AF_CCITT connections can use many X.25-specific
ioctl() calls.
X/Open Sockets Compilation Environment
See xopen_networking(7).
DEPENDENCIES
AF_CCITT and AF_VME_LINK
Only the SOCK_STREAM type is supported.
SCTP Only
Stream Control Transmission Protocol (SCTP) provides two styles of interfaces for applications that want
to communicate using SCTP as the transport protocol: one-to-one and one-to-many. The one-to-one style
is similar to TCP mode of operation whereas the one-to-many style is similar to the UDP mode of opera-
tion.
Applications can create a one-to-one style socket using the following syntax:
int socket(AF_INET, SOCK_STREAM, IPPROTO_SCTP);
or
int socket(AF_INET6, SOCK_STREAM, IPPROTO_SCTP);
To create a one-to-many style socket, the syntax is:
int socket(AF_INET, SOCK_SEQPACKET, IPPROTO_SCTP);
or
int socket(AF_INET6, SOCK_SEQPACKET, IPPROTO_SCTP);
The first form for both styles creates an endpoint which can use only IPv4 addresses. The second form
creates an endpoint which can use both IPv6 and IPv4 addresses. For more details, see sctp (7).
Note: SCTP is only available when the SCTP optional bundle is installed.
RETURN VALUE
socket() returns the following values:
n Successful completion. n is a valid file descriptor referring to the socket.
-1 Failure. errno is set to indicate the error.
ERRORS
If
socket() fails, errno is set to one of the following values.
[EAFNOSUPPORT] The specified address family is not supported in this version of the sys-
tem.
[EHOSTDOWN] The networking subsystem is not up.
[EINVAL] SOCK_DGRAM sockets are currently not supported for the AF_UNIX or
AF_VME_LINK address families.
[EMFILE] The per-process descriptor table is full.
[ENFILE] The system’s table of open files is temporarily full and no more
socket() calls can be accepted.
[ENOBUFS] No buffer space is available. The socket cannot be created.
[ENOMEM] No memory is available. The socket cannot be created.
[EPROTONOSUPPORT] The specified protocol is not supported.
[EPROTOTYPE] The type of socket and protocol do not match.
2 Hewlett-Packard Company 2 HP-UX 11i Version 3: September 2010