*** UNIX MANUAL PAGE BROWSER ***

A Nergahak database for man pages research.

Navigation

Directory Browser

1Browse 4.4BSD4.4BSD
1Browse Digital UNIXDigital UNIX 4.0e
1Browse FreeBSDFreeBSD 14.3
1Browse MINIXMINIX 3.4.0rc6-d5e4fc0
1Browse NetBSDNetBSD 10.1
1Browse OpenBSDOpenBSD 7.7
1Browse UNIX v7Version 7 UNIX
1Browse UNIX v10Version 10 UNIX

Manual Page Search

Manual Page Result

0 Command: recvfrom | Section: 2 | Source: Digital UNIX | File: recvfrom.2.gz
recvfrom(2) System Calls Manual recvfrom(2) NAME recvfrom - Receives messages from sockets SYNOPSIS #include <sys/socket.h> ssize_t recvfrom( int socket, void *buffer, size_t length, int flags, struct sockaddr *address, size_t *ad- dress_len) ; [Digital] The following definition of the recvfrom() function does not conform to current standards and is supported only for backward compat- ibility (see standards(5)): int recvfrom( int socket, char *buffer, int length, int flags, struct sockaddr *address, int *address_len) ; STANDARDS Interfaces documented on this reference page conform to industry stan- dards as follows: recvfrom(): XPG4-UNIX Refer to the standards(5) reference page for more information about in- dustry standards and associated tags. PARAMETERS Specifies the socket file descriptor. Specifies a pointer to the buffer to which the message should be written. Specifies the length in bytes of the buffer pointed to by the buffer parameter. Points to a value that controls message reception. The parameter to control message reception is formed by the logical OR of one or more of the following values: Peeks at the incoming message. Processes out-of-band data. Requests that the function block wait until the full amount of data re- quested can be returned. The function may return a smaller amount of data if a signal is caught, the connection is terminated, or an error is pending for the socket. Points to a sockaddr structure, the format of which is determined by the domain and by the behavior requested for the socket. The sockaddr structure is an overlay for a sockaddr_in or sockaddr_un structure, depending on which of the supported address fam- ilies is active. [Digital] If the compile-time option _SOCKADDR_LEN is defined before the sys/socket.h header file is included, the sockaddr structure takes 4.4BSD behavior, with a field for specifying the length of the socket address. Otherwise, the default 4.3BSD sockaddr structure is used, with the length of the socket ad- dress assumed to be 14 bytes or less. If _SOCKADDR_LEN is defined, the 4.3BSD sockaddr structure is defined with the name osockaddr. Specifies the length of the sockaddr structure pointed to by the address parameter. DESCRIPTION The recvfrom() function permits an application program to receive mes- sages from unconnected sockets. It is normally applied to unconnected sockets because it includes parameters that permit a calling program to retrieve the source endpoint of received data. To obtain the source address of the message, specify a nonzero value for the address parameter. The recvfrom() function is called with the address_len parameter set to the size of the buffer specified by the address parameter. On return, this function modifies the address_len parameter to the actual size in bytes of the address specified by the address parameter. The recvfrom() function returns the length of the message written to the buffer pointed to by the buffer parameter. When a message is too long for the specified buffer, excess bytes may be truncated depending on the type of socket that issued the message, and depending on which flags are set with the flags parameter. When no message is available at the socket specified by the socket pa- rameter, the recvfrom() function waits for a message to arrive, unless the socket is nonblocking. When the socket is nonblocking, errno is set to [EWOULDBLOCK]. NOTES [Digital] When compiled in the X/Open UNIX environment, calls to the recvfrom() function are internally renamed by prepending _E to the function name. When you are debugging a module that includes the recvfrom() function and for which _XOPEN_SOURCE_EXTENDED has been de- fined, use _Erecvfrom to refer to the recvfrom() call. See stan- dards(5) for further information. RETURN VALUES Upon successful completion, the byte length of the written message is returned. Otherwise, a value of -1 is returned and errno is set to in- dicate the error. ERRORS If the recvfrom() function fails, errno may be set to one of the fol- lowing values: The socket parameter is not a valid file descriptor. A connection was forcibly closed by a peer. A valid message buffer was not specified. Nonexistent or protected address space is specified for the message buffer. A signal interrupted recvfrom before any data was available. The MSG-OOB flag is set and no out-of-band data is avail- able. A receive is attempted on a connection-oriented socket that is not connected. The socket parameter refers to a file, not a socket. The specified flags are not supported this socket type. The connection timed out during connection establishment, or due to a transmission timeout on active connection. The socket is nonblocking; no data is ready to be received. RELATED INFORMATION Functions: recv(2), recvmsg(2), send(2), sendmsg(2), sendto(2), se- lect(2), shutdown(2), socket(2), read(2), write(2) Standards: standards(5) delim off recvfrom(2)

Navigation Options