[Overview][Constants][Types][Procedures and functions][Index] | Reference for unit 'Sockets' (#rtl)

# fpgetsockopt

Get current socket options

## Declaration

Source position: socketsh.inc line 173

`function fpgetsockopt(`
`s: cint;`
`level: cint;`
`optname: cint;`
`optval: pointer;`
`optlen: pSockLen`
`):cint;`

## Description

fpGetSockOpt gets the connection option optname, for socket S. The socket may be obtained from different levels, indicated by Level, which can be one of the following:

SOL_SOCKET
  From the socket itself.
XXX
  set Level to XXX, the protocol number of the protocol which should interpret the option.

The options are stored in the memory location pointed to by optval. optlen should point to the initial length of optval, and on return will contain the actual length of the stored data.

On success, 0 is returned. On Error, -1 is returned.

## Errors

Errors are reported in SocketError, and include the following:

ESockEBADF
  The socket descriptor is invalid.
ESockENOTSOCK
  The descriptor is not a socket.
ESockEFAULT
  OptVal points outside your address space.

## See also

fpSetSockOpt |  | Set socket options.

Documentation generated on: Feb 26 2014