]> git.karo-electronics.de Git - karo-tx-redboot.git/blob - packages/net/tcpip/v2_0/doc/getsockopt.html
Initial revision
[karo-tx-redboot.git] / packages / net / tcpip / v2_0 / doc / getsockopt.html
1 <html>
2 <body>
3 <pre>
4 NAME
5        getsockopt, setsockopt - get and set options on sockets
6
7 SYNOPSIS
8        #include &lt;network.h&gt;
9
10        int  getsockopt(int  s, int level, int optname, void *opt­
11        val, socklen_t *optlen);
12
13        int setsockopt(int s, int level, int optname,  const  void
14        *optval, socklen_t optlen);
15
16 DESCRIPTION
17        Getsockopt  and  setsockopt manipulate the options associ­
18        ated with a socket.  Options may exist at multiple  proto­
19        col  levels;  they  are  always  present  at the uppermost
20        socket level.
21
22        When manipulating socket options the level  at  which  the
23        option  resides  and the name of the option must be speci­
24        fied.  To manipulate options at the socket level, level is
25        specified  as  SOL_SOCKET.   To  manipulate options at any
26        other level the protocol number of the appropriate  proto­
27        col  controlling  the option is supplied.  For example, to
28        indicate that an option is to be interpreted  by  the  TCP
29        protocol,  level  should  be set to the protocol number of
30        TCP; see getprotoent(3).
31
32        The parameters optval and optlen are used to access option
33        values  for  setsockopt.   For  getsockopt they identify a
34        buffer in which the value for the requested option(s)  are
35        to  be returned.  For getsockopt, optlen is a value-result
36        parameter, initially containing the  size  of  the  buffer
37        pointed  to  by optval, and modified on return to indicate
38        the actual size of the value returned.  If no option value
39        is to be supplied or returned, optval may be NULL.
40
41        Optname and any specified options are passed uninterpreted
42        to the appropriate  protocol  module  for  interpretation.
43        The  include  file &lt;network.h&gt; contains definitions for
44        socket level options, described below.  Options  at  other
45        protocol  levels  vary  in  format  and  name; consult the
46        appropriate entries in section 4 of the manual.
47
48        Most socket-level options utilize  an  int  parameter  for
49        optval.   For setsockopt, the parameter should be non-zero
50        to enable a boolean option, or zero if the option is to be
51        disabled.
52
53        For  a  description  of  the  available socket options see
54        socket(7) and the appropriate protocol man pages.
55
56 RETURN VALUE
57        On success, zero is returned.  On error, -1  is  returned,
58        and errno is set appropriately.
59
60 ERRORS
61        EBADF   The argument s is not a valid descriptor.
62
63        ENOTSOCK
64                The argument s is a file, not a socket.
65
66        ENOPROTOOPT
67                The option is unknown at the level indicated.
68 </pre>
69 </body>
70 </html>