Topic Path: Symbol Reference > Classes > TIdStackLinux Class > TIdStackLinux Methods > SetSocketOption Method > SetSocketOption Method (TIdStackSocketHandle, Integer, Integer, PChar, Integer)
ContentsIndexHome
PreviousUpNext
TIdStackLinux.SetSocketOption Method (TIdStackSocketHandle, Integer, Integer, PChar, Integer)

Sets socket options for the socket handle.

procedure SetSocketOption(
    const ASocket: TIdStackSocketHandle; 
    const Alevel: Integer; 
    const Aoptname: Integer; 
    Aoptval: PChar; 
    const Aoptlen: 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.
 
AOptLen 
Option length for the indicted value. 

SetSocketOption is an overloaded abstract virtual procedure used to access the SetSockOpt() API for a 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. 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 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 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. 

 

SetSocketOption must be implemented in a descendant class to access the SetSockOpt() API for a specific protocol stack implementation.

TIdStack.SetSocketOption 

TIdStackBSDBase.SetSocketOption

Copyright 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Post feedback to the Indy Docs Newsgroup.