Internet Direct (Indy) Version 9.0.2 Beta
TIdSocketHandle.SetSockOpt
Sets socket options.

procedure SetSockOpt(level: Integer; optname: Integer; optval: PChar; optlen: Integer);
Parameters
level: Integer
Option level Id_SOL_SOCKET, Id_IPPROTO_TCP, or Id_IPPROTO_IP.

optname: Integer
Socket option to receive the option value.

optval: PChar
Value for the requested option.

optlen: Integer
Length of the option value buffer.

Description
SetSockOpt is a procedure used to set the value of socket-level options for a socket descriptor. Options can control socket operations such as receiving Out-Of-Band data, broadcasting datagram packets, and much more.

There are two types of socket options: Boolean and Data. Boolean options enable or disable a specific feature. Use a zero value in OptVal to disable a feature, and a non-zero value in OptVal to enable the feature.

Data options require the address used to store the value or structure in OptVal. OptNames use the contant values declared in IdStackConts.pas, including:

Allow transmission of broadcast messages on the socket.

Record debugging information.

Don't block CloseSocket for unsent data.

Don't route dsata, send it directly to the interface.

Send keepalive packets.

Linger on close if unsent data is present.

Receive out-of-band data in the normal data stream.

Specify buffer size for receives.

Allow the socket to be bound to an address which is already in use.

Specify buffer size for sends.

Receive timeout.

Send timeout.

Set Time-To-Live in IP header fields.

Disables the Nagle algorithm for send coalascing.