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

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

    Sends bytes through a socket to its connected peer.
    The $QIO equivalent is the IO$_WRITEVBLK function.
    Format
      #include  <types.h>
      #include  <socket.h>
      int send  ( int s, char *msg, int len, int flags );

  1 - Arguments

 s
    A socket descriptor created with the socket() function that was
    connected to another socket using the accept() or connect()
    function.
 msg
    A pointer to a buffer containing the data to be sent.
 len
    The length, in bytes, of the data pointed to by msg.
 flags
    Can be either 0 or MSG_OOB. If it is MSG_OOB, the data is sent
    out of band. Data can be received before other pending data on
    the receiving socket if the receiver also specifies MSG_OOB in
    the flag argument of its recv() or recvfrom()  call.

  2 - Description

    You can use this function only on connected sockets. To send
    data on an unconnected socket, use the sendmsg() or sendto()
    function. The send() function passes data along to its connected
    peer, which can receive the data by using the recv() or read()
    function.
    If there is no space available to buffer the data being sent
    on the receiving end of the connection, send() normally blocks
    until buffer space becomes available. If the socket is defined as
    nonblocking, however, send() fails with an errno indication of
    EWOULDBLOCK. If the message is too large to be sent in one piece,
    and the socket type requires that messages be sent atomically
    (SOCK_DGRAM), send() fails with an errno indication of EMSGSIZE.
    No indication of failure to deliver is implicit in a send(). All
    errors (except EWOULDBLOCK) are detected locally. You can use the
    select() function to determine when it is possible to send more
    data.
    Related Functions
    See also read(), recv(),  recvmsg(), recvfrom(), getsockopt(),
    and socket().

  3 - Return Values

    n                  The number of bytes sent. This value normally
                       equals len.
    -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.
    EDESTADDRREQ       The socket is not connection-oriented, and no
                       peer address is set.
    EFAULT             The message argument is not in a readable or
                       writable part of the user address space.
    EINTR              A signal interrupted the send() before any
                       data was transmitted.
    EMSGSIZE           The message is too large to be sent all at
                       once, as the socket requires.
    ENETDOWN           The local network connection is not
                       operational.
    ENETUNREACH        The destination network is unreachable.
    ENOBUFS            The system has insufficient resources to
                       complete the call.
    ENOTCONN           The socket is not connected or has not had the
                       peer prespecified.
    ENOTSOCK           The socket descriptor is invalid.
    EOPNOTSUPP         The socket argument is associated with a
                       socket that does not support one or more of
                       the values set in flags.
    EWOULDBLOCK        The socket is marked nonblocking, and no space
                       is available for the send() function.
  Close     HLB-list     TLB-list     Help  

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