Topic Path: Symbol Reference > Classes > TIdStackWindows Class > TIdStackWindows Methods > SetSocketOption Method > SetSocketOption Method (TIdStackSocketHandle, TIdSocketProtocol, TIdSocketOption, Integer)
ContentsIndexHome
PreviousUpNext
TIdStackWindows.SetSocketOption Method (TIdStackSocketHandle, TIdSocketProtocol, TIdSocketOption, Integer)

Sets socket options for the socket handle.

procedure SetSocketOption(
    ASocket: TIdStackSocketHandle; 
    ALevel: TIdSocketProtocol; 
    AOptName: TIdSocketOption; 
    AOptVal: Integer
); override; 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 procedure used to access the SetSockOpt() API for the protocol stack implementation. 

SetSocketOption is used to set 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. 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 information. 
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 interface. 
SOL_SOCKET SO_GROUP_PRIORITY Integer 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 Integer 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 Integer 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. 
Copyright 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Post feedback to the Indy Docs Newsgroup.