As with normal arguments, all return codes and values from functions are of type integer unless otherwise noted. An error number that is not cleared on successful calls is also made available in the errno external variable. Thus errno should be tested only after an error has occurred.
The following is a complete list of the socket errors and their names as given in <sys/errno.h>. See Intro(S-osr5) for a more comprehensive list of error codes.
An operation on a socket or pipe was not performed because the system lacked sufficient buffer space or because a queue was full. ENOBUFS is defined to have the same value as ENOSR.
An operation that would cause a process to block was attempted on an object in non-blocking mode (see fcntl(S-osr5)).
An operation that takes a long time to complete (such as a connect(SSC-osr5)) was attempted on a non-blocking object (see fcntl(S-osr5)).
An operation was attempted on a non-blocking object that already had an operation in progress.
A required address was omitted from an operation on a socket.
A message sent on a socket was larger than the internal message buffer or some other network limit.
A protocol was specified that does not support the semantics of the socket type requested. For example, you cannot use the ARPA Internet UDP protocol with type SOCK_STREAM.
The protocol has not been configured into the system or no implementation for it exists.
The support for the socket type has not been configured into the system or no implementation for it exists.
For example, trying to accept a connection on a datagram socket.
The protocol family has not been configured into the
system or no implementation for it exists.
An address incompatible with the requested protocol was used. For example, you shouldn't necessarily expect to be able to useNS addresses with ARPA Internet protocols.
Only one usage of each address is normally permitted.
Normally results from an attempt to create a socket with an address not on this machine.
A socket operation encountered a dead network.
A socket operation was attempted to an unreachable network.
The host you were connected to crashed and rebooted.
A connection abort was caused internal to your host machine.
A connection was forcibly closed by a peer. This normally results from a loss of the connection on the remote socket due to a timeout or a reboot.
request was made on an already connected socket; or,
request on a connected socket specified a destination
when already connected.
A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket) no address was supplied.
A request to send data was disallowed because the socket had already been shut down with a previous shutdown(SSC-osr5) call.
A connect or send request failed because the connected party did not properly respond after a period of time. (The timeout period is dependent on the communication protocol.)
No connection could be made because the target machine actively refused it. This usually results from trying to connect to a service that is inactive on the foreign host.
A socket operation failed because the destination host was down.
A socket operation was attempted to an unreachable host.
A bad option or level was specified in a getsockopt(SSC-osr5) or setsockopt(SSC-osr5) call.
Sockets are typed according to their communications properties. These properties include whether messages sent and received at a socket require the name of the partner, whether communication is reliable, the format used in naming message recipients, etc.
Each instance of the system supports some collection of socket types; consult socket(SSC-osr5) for more information about the types available and their properties.
Each instance of the system supports some number of sets of communications protocols. Each protocol set supports addresses of a certain format. An Address Family is the set of addresses for a specific group of protocols. Each socket has an address chosen from the address family in which the socket was created.
|Name||Appears on Page||Description|
|accept||accept(SSC-osr5)||accept a connection on a socket|
|bind||bind(SSC-osr5)||bind a name to a socket|
|connect||connect(SSC-osr5)||initiate a connection on a socket|
|getpeername||getpeername(SSC-osr5)||get name of connected peer|
|getsockname||getsockname(SSC-osr5)||get socket name|
|getsockopt||getsockopt(SSC-osr5)||get options on sockets|
|gettimeofday||gettimeofday(SSC-osr5)||get date and time|
|listen||listen(SSC-osr5)||listen for connections on a socket|
|recv||recv(SSC-osr5)||receive a message from a connected socket|
|recvfrom||recv(SSC-osr5)||receive a message from a socket|
|recvmsg||recv(SSC-osr5)||receive a message from a socket|
|send||send(SSC-osr5)||send a message to a connected socket|
|sendmsg||send(SSC-osr5)||send a message to a socket|
|sendto||send(SSC-osr5)||send a message to a socket|
|setsockopt||getsockopt(SSC-osr5)||set options on sockets|
|settimeofday||gettimeofday(SSC-osr5)||set date and time|
|shutdown||shutdown(SSC-osr5)||shut down part of a full-duplex connection|
|socket||socket(SSC-osr5)||create an endpoint for communication|
|socketpair||socketpair(SSC-osr5)||create a pair of connected sockets|