Functions and Directives

Function SocketSetOption() Professional

Sets a socket option.

SocketSetOption( <nSocket>, ;
                 <nOption>, ;
                 <xValue>   ) --> lSuccess
This is a numeric socket descriptor identifying a socket.
The socket option for which to set a new value is identified with a #define constant from SOCKET.CH:
Constants for socket options
Constant Option
SO_BROADCAST Allow transmission of broadcast messages on the socket.
SO_DEBUG Record debugging information.
SO_DONTLINGER Do not block close waiting for unsent data to be sent.
SO_DONTROUTE Do not route: send directly to interface.
SO_KEEPALIVE Send keepalives.
SO_LINGER Linger on close if unsent data is present.
SO_OOBINLINE Receive out-of-band data in the normal data stream.
SO_RCVBUF Specify buffer size for receives.
SO_REUSEADDR Allow the socket to be bound to an address which is already in use.
SO_SNDBUF Specify buffer size for sends.
This parameter holds the new value for the socket option specified with <nOption>.
Values for socket options
<nOption> Value assigned to <xValue>
SO_BROADCAST Logical value to enable/disable broadcast messages.
SO_DEBUG Logical value to set debug info recording on or off.
SO_DONTLINGER Logical value to enable/disable wait for unsent messages.
SO_KEEPALIVE Logical value to enable/diable sending of keepalives
SO_LINGER Array of linger parameters: { lOnOff, nTimeout }
SO_OOBINLINE Logical value to enable/disable inline OOB data.
SO_RCVBUF Numeric buffer size for receives.
SO_REUSEADDR Logical value to enable/disable address reusage.
SO_SNDBUF Numeric Buffer size for sends.

The function returns .T. (true) when the value of the specified option is successfully set, otherwise .F. (false) is returned.


SocketSetOption() sets the current value for a socket option associated with a socket of any type, in any state.


If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.