Internet Direct (Indy)
Home
PreviousUpNext
TIdStack.SetSocketOption Method

Sets socket options for the socket handle.

Pascal
procedure SetSocketOption(
    ASocket: TIdStackSocketHandle; 
    ALevel: TIdSocketOptionLevel; 
    AOptName: TIdSocketOption; 
    AOptVal: Integer
); virtual; abstract; overload;
Parameters 
Description 
ASocket 
Socket handle used to set the indicates options.
 
ALevel 
Level where the socket option is defined.
 
AOptName 
Option name for the indicated value.
 
AOptVal 
Option value for the indicated name. 

SetSocketOption is an overloaded abstract virtual procedure used to access the SetSockOpt() API for a protocol stack implementation. 

SetSocketOption sets the current value for a named socket option associated with the socket handle in ASocket. 

There are two types of socket options: Boolean options that enable or disable a feature or behavior, and options that require an integer value or structure. To enable a Boolean option, optval points to a nonzero integer. To disable the option optval points to an integer equal to zero. The optlen parameter should be equal to sizeof(int) for Boolean options. For other options, optval points to the an integer or structure that contains the desired value for the option, and optlen is the length of the integer or structure. 

The following options are supported for SetSocketOption. The Type identifies the type of data addressed by AOptVal. 

 

Level Name Type Meaning 
 

--------- --------------------- ------- ----------------------------

 

SOL_SOCKET SO_BROADCAST BOOL Allows transmission of broadcast messages on the socket. 
SOL_SOCKET SO_CONDITIONAL_ACCEPT BOOL Enables sockets to delay the acknowledgment of a connection until after Accept is called. 
SOL_SOCKET SO_DEBUG BOOL Records debugging info. 
SOL_SOCKET SO_DONTLINGER BOOL Does not block close waiting for unsent data to be sent. Setting this option is equivalent to setting SO_LINGER with l_onoff set to zero. 
SOL_SOCKET SO_DONTROUTE BOOL Does not route: sends directly to the network interface. 
SOL_SOCKET SO_GROUP_PRIORITY int Reserved. 
SOL_SOCKET SO_KEEPALIVE BOOL Sends keep-alives. 
SOL_SOCKET SO_LINGER LINGER Lingers on close if unsent data is present. 
SOL_SOCKET SO_OOBINLINE BOOL Receives OOB data in the normal data stream. 
SOL_SOCKET SO_RCVBUF int Specifies the total per-socket buffer space reserved for receives. This is unrelated to SO_MAX_MSG_SIZE or the size of a TCP window. 
SOL_SOCKET SO_REUSEADDR BOOL Allows the socket to be bound to an address that is already in use. 
SOL_SOCKET SO_EXCLUSIVEADDRUSE BOOL Enables a socket to be bound for exclusive access. Does not require administrative privilege. 
SOL_SOCKET SO_SNDBUF int Specifies the total per-socket buffer space reserved for sends. This is unrelated to SO_MAX_MSG_SIZE or the size of a TCP window. 
IPPROTO_TCP TCP_NODELAY BOOL Disables the Nagle algorithm for send coalescing. 

TIdStack.SetSocketOption

Internet Direct (Indy) version 10.1.5
Copyright © 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Website http://www.indyproject.org.
Post feedback to the Indy Documentation newsgroup.