Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ socket.xs(3N-xs) — Reliant UNIX 5.44c4

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

accept(3N-xs)

bind(3N-xs)

connect(3N-xs)

getsockname(3N-xs)

getsockopt(3N-xs)

listen(3N-xs)

recv(3N-xs)

recvfrom(3N-xs)

recvmsg(3N-xs)

send(3N-xs)

sendmsg(3N-xs)

setsockopt(3N-xs)

shutdown(3N-xs)

socketpair(3N-xs)

socket(3N-xs)                 (X/OPEN SOCKETS)                socket(3N-xs)

NAME
     socket - create an endpoint for communication

SYNOPSIS
     cc [flag ...] file ... -lxnet [library ...]

     #include <sys/socket.h>

     int socket(int domain, int type, int protocol);

DESCRIPTION
     The socket function creates an unbound socket in a communications
     domain, and returns a file descriptor that can be used in later func-
     tion calls that operate on sockets.

     The function takes the following arguments:

     domain          Specifies the communications domain in which a socket
                     is to be created.

     type            Specifies the type of socket to be created.

     protocol        Specifies a particular protocol to be used with the
                     socket. Specifying a protocol of 0 causes socket to
                     use an unspecified default protocol appropriate for
                     the requested socket type.

     The domain argument specifies the address family used in the communi-
     cations domain. The address families supported by the system are
     implementation-dependent.

     The <sys/socket.h> header defines at least the following values for
     the domain argument:

     AFUNIX         File system pathnames.

     AFINET         Internet address.

     The type argument specifies the socket type, which determines the
     semantics of communication over the socket. The socket types supported
     by the system are implementation-dependent. Possible socket types
     include:

     SOCKSTREAM     Provides sequenced, reliable, bidirectional, connec-
                     tion-oriented byte streams, and may provide a trans-
                     mission mechanism for out-of-band data.

     SOCKDGRAM      Provides datagrams, which are connectionless, unreli-
                     able messages of fixed maximum length.






Page 1                       Reliant UNIX 5.44                Printed 11/98

socket(3N-xs)                 (X/OPEN SOCKETS)                socket(3N-xs)

     SOCKSEQPACKET  Provides sequenced, reliable, bidirectional, connec-
                     tion-oriented transmission path for records. A record
                     can be sent using one or more output operations and
                     received using one or more input operations, but a
                     single operation never transfers part of more than one
                     record. Record boundaries are visible to the receiver
                     via the MSGEOR flag.

     If the protocol argument is non-zero, it must specify a protocol that
     is supported by the address family. The protocols supported by the
     system are implementation-dependent.

RETURN VALUE
     Upon successful completion, socket returns a non-negative integer, the
     socket file descriptor. Otherwise a value of -1 is returned and errno
     is set to indicate the error.

ERRORS
     The socket function will fail if:

     EACCES          The process does not have appropriate privileges.

     EAFNOSUPPORT    The implementation does not support the specified
                     address family.

     EMFILE          No more file descriptors are available for this pro-
                     cess.

     ENFILE          No more file descriptors are available for the system.

     EPROTONOSUPPORT The protocol is not supported by the address family,
                     or the protocol is not supported by the implementa-
                     tion.

     EPROTOTYPE      The socket type is not supported by the protocol.

     The socket function may fail if:

     ENOBUFS         The resources available in the system were not suffi-
                     cient to perform the operation.

     ENOMEM          The memory available was not sufficient to fulfill the
                     request.

     ENOSR           The STREAMS resources available were not sufficient to
                     complete the operation.








Page 2                       Reliant UNIX 5.44                Printed 11/98

socket(3N-xs)                 (X/OPEN SOCKETS)                socket(3N-xs)

APPLICATION USAGE
     The documentation for specific address families specify which proto-
     cols each address family supports. The documentation for specific pro-
     tocols specify which socket types each protocol supports.

     The application can determine if an address family is supported by
     trying to create a socket with domain set to the protocol in question.

SEE ALSO
     accept(3N-xs), bind(3N-xs), connect(3N-xs), getsockname(3N-xs),
     getsockopt(3N-xs), listen(3N-xs), recv(3N-xs), recvfrom(3N-xs),
     recvmsg(3N-xs), send(3N-xs), sendmsg(3N-xs), setsockopt(3N-xs),
     shutdown(3N-xs), socketpair(3N-xs).









































Page 3                       Reliant UNIX 5.44                Printed 11/98

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026