www.beck-ipc.com

@CHIP-RTOS C Library - TCP/IP API


getsockopt

Get options on a socket.

int getsockopt ( int sd,
                 const GetSocketOption far *sockoptptr,
                 int *error );

Parameters

sd

Socket descriptor.

sockoptptr

Pointer to GetSocketOption type that specifies the socket options (see tcpipapi.h) and contains pointers to where the specified socket option will be reported to.

error

Output parameter:  Failure code, 0 on success.

Return Value

0 = success
Non-zero = Failure (see error output parameter)

Comments

On success, this function reports the requested socket option value to the buffer pointed to by the optionValue member of GetSocketOption type at sockoptptr and the length of this reported value is written to the location pointed to by the optionLen member.

The caller must setup the GetSocketOption type structure prior to calling.  In particular, the optionValue member must point to a sufficiently large buffer to receive the reported option value and the size of this buffer must be stated in the location referenced by the optionLen member.   Note that this length specifier is both an input and an output parameter for this function.  If on entry, the location referenced by optionLen contains a value less than the buffer space required to report the requested socket option value, then the function will fail and return error code 242.

The socket options of an incoming connection (using accept) will be the same as the socket options of the listening socket.

SC1x3/SC2x Comments

This legacy version of getsockopt() specified here is not compatible to the BSD 4.4 Socket API.   The getsockopt() function can be used in BSD 4.4 compatible mode if the compilation switch

     #define BSD44_SOCKET_API_STYLE

is defined in the user application prior to including the Beck C-Library header files.   Using this switch the C-Library TCPIP_Socket.H include file redefines getsockopt() to getsockopt_bsd().  The parameters to getsockopt_bsd() are identical to the parameters of the BSD4.4 socket getsockopt() function.

See Also

RTOS API

This library function invokes a RTOS software interrupt. Refer to this RTOS API function's documentation for more details.

Supported since or modified in @CHIP-RTOS version

    SC12SC13SC11SC1x3SC2x
    V1.00V1.00V1.00V0.90V1.00

This API List
List of C Libraries
@CHIP-RTOS Main Index


End of document