Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ recv(2) — DG/UX 4.00

Media Vault

Software Library

Restoration Projects

Artifacts Sought



                                                                  recv(2)



        _________________________________________________________________
        recv                                                  System Call
        Receive a message from a socket.
        _________________________________________________________________


        SYNTAX

        #include <socket.h>

        int   recv  (s, buf, len, user_flags)
        int             s;
        char *          buf;
        int             len;
        int             user_flags;


        PARAMETERS

        s              File descriptor of socket to receive data from.


        buf            Buffer for data.


        len            Length of buffer for data (bytes).


        user_flags     Flags for transfer.


        DESCRIPTION

        This call can only be used with connected sockets.

        If the message is too long to fit in the supplied buffer, excess
        bytes may be discarded depending on the type of socket the
        message is received from; datagram sockets truncate messages,
        stream sockets don't preserve packet boundaries so only the
        amount of data requested is received with no loss of data.

        The user_flags argument is constructed by or-ing zero or more
        literals beginning with "MSG_".  See <socket.h> for a description
        of what flags exist and what they do.

        If no messages are available at the socket, the call waits for a
        message to arrive, unless the socket is nonblocking (see ioctl).
        In that case, an error EAGAIN will be returned.

        The select call may be used to determine when more data arrives.




        DG/UX 4.00                                                 Page 1
               Licensed material--property of copyright holder(s)





                                                                  recv(2)



        ACCESS CONTROL

        None.


        RETURN VALUE

        Recv() returns the number of bytes received.


        0..<len>       Number of bytes transferred.


        -1             An error occurred.  Errno is set to indicate the
                       error.


        EXCEPTIONS

        Errno may be set to one of the following error codes:


        EBADF          The argument <s> is not an active valid
                       descriptor.


        ENOTSOCK       The argument <s> is not a socket.


        EAGAIN         The socket is marked non-blocking and the receive
                       operation would block.


        EINTR          The receive was interrupted by delivery of a
                       signal before any data was available for the
                       receive.


        EFAULT         The data was specified to be received into a non-
                       existent or protected part of the process address
                       space.


        EINVAL         Invalid argument.


        SEE ALSO

        The related manual sections:  read(2), send(2), socket(2).





        DG/UX 4.00                                                 Page 2
               Licensed material--property of copyright holder(s)



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