Library /sys$common/syshlp/HELPLIB.HLB  —  TCPIP Services, Programming Interfaces, Socket API Functions, getsockopt()
    Returns the options set on a socket.
    The $QIO equivalent is the IO$_SENSEMODE function.
    Format
      #include  <types.h>
      #include  <socket.h>
      int getsockopt  ( int s, int level, int optname, char *optval,
                      int *optlen ); (_DECC_V4_SOURCE)
      int getsockopt  ( int s, int level, int optname, void *optval,
                      size_t *optlen ); (not_DECC_V4_SOURCE)

1  –  Arguments

 s
    A socket descriptor created by the socket() function.
 level
    The protocol level for which the socket options are desired. It
    can have one of the following values:
    SOL_SOCKET         Get the options at the socket level.
    p                  Any protocol number. Get the options for
                       protocol level specified by p. The IPPROTO
                       values are defined in the IN.H header file
                       (for IPv4), or the IN6.H header file (for
                       IPv6).
 optname
    Interpreted by the protocol specified in the level. Options at
    each protocol level are documented with the protocol.
    For descriptions of the supported socket level options, see the
    description of setsockopt() in this chapter.
 optval
    Points to a buffer in which the value of the specified option
    should be placed by getsockopt().
 optlen
    Points to an integer containing the size of the buffer pointed
    to by optval. On return, the integer is modified to indicate the
    actual size of the option value returned.

2  –  Description

    This function gets information on socket options. See the
    appropriate protocol for information about available options
    at each protocol level.

3  –  Return Values

    0                  Successful completion.
    -1                 Error; errno is set to indicate the error.

4  –  Errors

    EACCES             The calling process does not have appropriate
                       permissions.
    EBADF              The socket descriptor is invalid.
    EDOM               The send and receive timeout values are too
                       large to fit in the timeout fields of the
                       socket structure.
    EFAULT             The address pointed to by the optval argument
                       is not in a valid (writable) part of the
                       process space, or the optlen argument is not
                       in a valid part of the process address space.
    EINVAL             The optval or optlen argument is invalid; or
                       the socket is shut down.
    ENOBUFS            The system has insufficient resources to
                       complete the call.
    ENOTSOCK           The socket descriptor is invalid.
    ENOPROTOOPT        The option is unknown or the protocol is
                       unsupported.
    EOPNOTSUPP         The operation is not supported by the socket
                       protocol.
    ENOPROTOOPT        The option is unknown.
    ENOTSOCK           The socket descriptor is invalid.
Close Help