


sendmsg(3)                                             sendmsg(3)


NNAAMMEE
       sendmsg - send a message from a socket

SSYYNNOOPPSSIISS
       ##iinncclluuddee <<ssyyss//ssoocckkeett..hh>>

       iinntt sseennddmmssgg((iinntt ss,, ssttrruucctt mmssgghhddrr **mmssgg,, iinntt ffllaaggss));;


DDEESSCCRRIIPPTTIIOONN
       _s_e_n_d_m_s_g  is  used to transmit a message to another socket.
       _s is a socket descriptor  that  specifies  the  socket  on
       which  the  message will be sent.  _m_s_g points to an object
       of type ssttrruucctt mmssgghhddrr that describes  the  message  to  be
       sent.  ssttrruucctt mmssgghhddrr is explained below.

       _s_e_n_d_m_s_g operates the same way as _s_e_n_d_t_o, except that it is
       able to gather the data given in  the  mmssgg__iioovv  member  of
       ssttrruucctt mmssgghhddrr.   Note that sending of access rights is not
       implemented.  _s_e_n_d_m_s_g returns an error as described  below
       if  you  try  to  send access rights.  Do not rely on this
       behavior, because it might change in the future.

       ssttrruucctt mmssgghhddrr is defined in <ssyyss//ssoocckkeett..hh>,  and  has  the
       following form :

              struct msghdr {
                   void *msg_name;     /* optional address */
                   size_t    msg_namelen;   /* size of address  */
                   struct iovec *msg_iov;   /* gather array for data */
                   size_t    msg_iovlen;    /* # of elements in msg_iov */
                   void    *msg_accrights;  /* access rights */
                   size_t    msg_accrightslen; /* size of msg_accrights */
              }

       _m_s_g___n_a_m_e  is  the  destination  address  if  the socket is
       unconnected; _m_s_g___n_a_m_e may be a null pointer if no name  is
       specified.   _m_s_g___i_o_v  is  the location of the gather data.
       _m_s_g___a_c_c_r_i_g_h_t_s specifies a buffer to send any access rights
       along  with the message.  Transfer of access rights is not
       implemented, so you should set the msg_acccrights field to
       NULL  indicating  that  access rights are not being trans-
       ferred.

       See _s_e_n_d_t_o_(_3_) to learn more about the behavior of _s_e_n_d_m_s_g.

RREETTUURRNN VVAALLUUEE
       If  the  _s_e_n_d_m_s_g call is successful, it returns the number
       of bytes sent.  If the call fails, -1 is returned  and  an
       error code is stored in eerrrrnnoo.

DDIIAAGGNNOOSSTTIICCSS
       The call to _s_e_n_d_m_s_g fails if:




                             MiNT-Net                           1





sendmsg(3)                                             sendmsg(3)


              [EBADF]               An   invalid  descriptor  was
                                    specified.

              [EMSGSIZE]            The socket requires that mes-
                                    sages be sent atomically, and
                                    the size of the message to be
                                    sent made this impossible.

              [EINTR]               The operation was interrupted
                                    by a signal before  any  data
                                    were sent.  (If some data was
                                    sent,  _s_e_n_d_m_s_g  returns   the
                                    number  of  bytes sent before
                                    the signal, and EINTR is  not
                                    given.)

              [EINVAL]              A member of the _m_s_g parameter
                                    is invalid or  the  specified
                                    destination  address  is  not
                                    valid.  The argument _s is not
                                    a socket.  Transfer of access
                                    rights is not implemented.

              [EDESTADDRREQ]        The  _t_o  parameter  needs  to
                                    specify a destination address
                                    for the message.

              [ENOMEM]              There is insufficient  buffer
                                    space to send the message.

              [ENOTCONN]            A  _s_e_n_d  on  a socket that is
                                    not connected, or a _s_e_n_d on a
                                    socket that has not completed
                                    the connect sequence with its
                                    peer,  or  is  no longer con-
                                    nected to its peer.

              [EISCONN]             An address was  specified  by
                                    _t_o  for  a  SOCK_DGRAM socket
                                    which is already connected.

              [EAFNOSUPPORT]        Requested  address  does  not
                                    match  the  address family of
                                    this socket.

              [EPIPE] and SIGPIPE signal
                                    An attempt was made  to  send
                                    on  a  socket  that  was con-
                                    nected,  but  the  connection
                                    has been shut down, either by
                                    the remote peer  or  by  this
                                    side of the connection.  Note
                                    that the default  action  for
                                    SIGPIPE,  unless  the process



                             MiNT-Net                           2





sendmsg(3)                                             sendmsg(3)


                                    has established a signal han-
                                    dler  for  this signal, is to
                                    terminate the process.

              [EOPNOTSUPP]          The MSG_OOB flag  was  speci-
                                    fied; it is not supported for
                                    AF_UNIX sockets.

SSEEEE AALLSSOO
       getsockopt(3), select(3), send(3), sendto(3), socket(3).















































                             MiNT-Net                           3


