VMS Help
TCPIP Services, Programming Interfaces, Sockets API, read()

 *Conan The Librarian (sorry for the slow response - running on an old VAX)

    Reads bytes from a socket or file and places them in a user-
    provided buffer.
    The $QIO equivalent is the IO$_READVBLK function.
    Format
      #include  <unixio.h>
      int read  ( int d, void *buffer, int nbytes );

  1 - Arguments

 d
    A descriptor that must refer to a socket or file currently opened
    for reading.
 buffer
    The address of a user-provided buffer in which the input data is
    placed.
 nbytes
    The maximum number of bytes allowed in the read operation.

  2 - Description

    If the end of file is not reached, the read() function returns
    nbytes. If the end of file occurs during the read() function, it
    returns the number of bytes read.
    Upon successful completion, read() returns the number of bytes
    actually read and placed in the buffer.
    Related Functions
    See also socket().

  3 - Return Values

    x                  The number of bytes read and placed in the
                       buffer.
    0                  Peer has closed the connection.
    -1                 Error; errno is set to indicate the error.

  4 - Errors

    EBADF              The socket descriptor is invalid.
    ECONNRESET         A connection was forcibly closed by a peer.
    EFAULT             The data was specified to be received into a
                       nonexistent or protected part of the process
                       address space.
    EINTR              A signal interrupted the recv() function
                       before any data was available.
    EINVAL             The MSG_OOB flag is set and no out-of-band
                       data is available.
    ENOBUFS            The system has insufficient resources to
                       complete the call.
    ENOMEM             The system did not have sufficient memory to
                       fulfill the request.
    ENOTCONN           A receive is attempted on a connection-
                       oriented socket that is not connected.
    ENOTSOCK           The socket descriptor is invalid.
    EOPNOTSUPP         The specified flags are not supported for this
                       socket type or protocol.
    EWOULDBLOCK        The socket is marked nonblocking, and no data
                       is waiting to be received.
  Close     HLB-list     TLB-list     Help  

[legal] [privacy] [GNU] [policy] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.