|
|
#include <sys/errno.h>
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) 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)).
An operation that takes a long time to complete (such as a connect(SSC)) was attempted on a non-blocking object (see fcntl(S)).
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.
A connect
request was made on an already connected socket; or,
a
sendto
or
sendmsg
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) 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) or setsockopt(SSC) 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) 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) | accept a connection on a socket |
bind | bind(SSC) | bind a name to a socket |
connect | connect(SSC) | initiate a connection on a socket |
getpeername | getpeername(SSC) | get name of connected peer |
getsockname | getsockname(SSC) | get socket name |
getsockopt | getsockopt(SSC) | get options on sockets |
gettimeofday | gettimeofday(SSC) | get date and time |
listen | listen(SSC) | listen for connections on a socket |
recv | recv(SSC) | receive a message from a connected socket |
recvfrom | recv(SSC) | receive a message from a socket |
recvmsg | recv(SSC) | receive a message from a socket |
send | send(SSC) | send a message to a connected socket |
sendmsg | send(SSC) | send a message to a socket |
sendto | send(SSC) | send a message to a socket |
setsockopt | getsockopt(SSC) | set options on sockets |
settimeofday | gettimeofday(SSC) | set date and time |
shutdown | shutdown(SSC) | shut down part of a full-duplex connection |
socket | socket(SSC) | create an endpoint for communication |
socketpair | socketpair(SSC) | create a pair of connected sockets |