Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ send(SSC) — OpenDesktop Software Development System 3.0.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

Intro(SSC)

recv(SSC)

socket(SSC)

intro(ADMP)


 send(SSC)                      6 January 1993                      send(SSC)


 Name

    send, sendto - send a message to a socket

 Syntax


    #include <sys/types.h>
    #include <sys/socket.h>

    int send(s, msg, len, flags)
    int s;
    char *msg;
    int len, flags;

    int sendto(s, msg, len, flags, to, tolen)
    int s;
    char *msg;
    int len, flags;
    struct sockaddr *to;
    int tolen;


 Description

    send and sendto are used to transmit a message to another socket(s).
    send may be used only when the socket is in a connected state, while
    sendto may be used at any time.

    The address of the target is given by to with tolen specifying its size.
    The length of the message is given by len.  If the message is too long to
    pass atomically through the underlying protocol, then the error EMSGSIZE
    is returned, and the message is not transmitted.

    No indication of failure to deliver is implicit in a send.  Return values
    of -1 indicate some locally detected errors.

    If no message space is available at the socket to hold the message to be
    transmitted, then send blocks.

    The flags parameter may be set to MSGOOB to send ``out-of-band'' data on
    sockets which support this notion (for example, SOCKSTREAM).

 Return value

    The call returns the number of characters sent, or -1 if an error
    occurred.

 Errors


    [EBADF]             An invalid descriptor was specified.

    [ENOTSOCK]          The argument s is not a socket.

    [EFAULT]            An invalid user space address was specified for a
                        parameter.

    [EMSGSIZE]          The socket requires that the message not fragmented,
                        but the message is too large to avoid fragmentation.

 See also

    Intro(SSC), recv(SSC), socket(SSC) and intro(ADMP).


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