


shutdown(3)                                           shutdown(3)


NNAAMMEE
       shutdown - shut down a socket

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

       iinntt sshhuuttddoowwnn((iinntt ss,, iinntt hhooww));;

DDEESSCCRRIIPPTTIIOONN
       The  _s_h_u_t_d_o_w_n  library call is used to shut down a socket.
       In the case of a full-duplex connection, _s_h_u_t_d_o_w_n  can  be
       used  to  either  partially or fully shut down the socket,
       depending upon the value of _h_o_w:

       0    Further receives are disallowed
       1    Further sends are disallowed
       2    Further sends and receives are disallowed

       The _s parameter is a socket descriptor for the  socket  to
       be shut down.

       Once  the socket has been shut down for receives, all fur-
       ther _r_e_c_v(3) calls return  an  end-of-file  condition.   A
       socket  that has been shut down for sending causes further
       _s_e_n_d(3) calls to return an EPIPE error and send  the  SIG-
       PIPE  signal.   After  a  socket has been fully shut down,
       operations other than _r_e_c_v(3) and _s_e_n_d(3) return appropri-
       ate  errors,  and the only other thing that can be done to
       the socket is a _c_l_o_s_e(3).

       Multiple shutdowns on a connected socket and shutdowns  on
       a socket that is not connected might not return errors.

       A _s_h_u_t_d_o_w_n on a connectionless socket, such as SOCK_DGRAM,
       only marks the socket as unable to do further  _s_e_n_d(3)  or
       _r_e_c_v(3)  calls,  depending  upon  _h_o_w.   Once this type of
       socket has been disabled for both  sending  and  receiving
       data,  it  becomes fully shut down.  For SOCK_STREAM sock-
       ets, if _h_o_w is 11 oorr 22, the connection begins to be  closed
       gracefully  in  addition  to the normal actions.  However,
       the _s_h_u_t_d_o_w_n call does not wait for the completion of  the
       graceful  disconnection.   The  disconnection  is complete
       when both sides of the connection  have  done  a  _s_h_u_t_d_o_w_n
       with  _h_o_w  equal  to 11 oorr 22.  Once the connection has been
       completely terminated, the socket becomes fully shut down.
       The  SO_LINGER  option  (see  _s_o_c_k_e_t(3)) does not have any
       meaning for the _s_h_u_t_d_o_w_n call, but does for  the  _c_l_o_s_e(3)
       call.   For  more  information  on  how  the _c_l_o_s_e(3) call
       interacts with sockets, see _s_o_c_k_e_t(3).

       If a _s_h_u_t_d_o_w_n is performed on a  SOCK_STREAM  socket  that
       has  a  _l_i_s_t_e_n(3) pending on it, that socket becomes fully
       shut down when _h_o_w = 1.




                             MiNT-Net                           1





shutdown(3)                                           shutdown(3)


RREETTUURRNN VVAALLUUEE
       If the call is successful, 0 is returned.  If it fails, -1
       is returned and an error code is stored in eerrrrnnoo.

DDIIAAGGNNOOSSTTIICCSS
       The _s_h_u_t_d_o_w_n call fails if:

       [EBADF]        _s is not a valid descriptor.

       [EINVAL]       The  socket  is already fully shut down.  _s
                      is not a socket descriptor.

SSEEEE AALLSSOO
       close(3), connect(3), socket(3).











































                             MiNT-Net                           2


