Function SocketGetOption() Professional

Retrieves a socket option.

SocketGetOption( <nSocket>, ;
                 <nOption>, ;
                 @<xValue>  ) --> lSuccess
This is a numeric socket descriptor identifying a socket.
The socket option for which to retrieve the current value is identified with a #define constant from SOCKET.CH:
Constants for socket options
Constant Option
SO_ACCEPTCONN Checks if socket is in listening mode.
SO_BROADCAST Checks if transmission of broadcast messages is allowed on the socket.
SO_DEBUG Checks if record debugging information is on or off.
SO_DONTLINGER Checks if socket blocks on close when there is pending data. This option is equivalent with the first element of the SO_LINGER array set to .F.
SO_DONTROUTE Checks if routing is enabled.
SO_KEEPALIVE Checks if keepalives are sent.
SO_LINGER Linger on close if unsent data is present.
SO_OOBINLINE Checks if out-of-band data is received in the normal data stream.
SO_RCVBUF Specifies buffer size for receive oerations.
SO_REUSEADDR checks if socket may be bound to an address which is already in use.
SO_SNDBUF Specifies buffer size for send operations.
TC_NODELAY Checks if the Nagle algorithm for sends is enabled.
This parameter must be passed by reference. It gets assigned the current value of the option specified with <nOption>.
Values for socket options
<nOption> Value assigned to <xValue>
SO_ACCEPTCONN .T. if socket is in listening mode, .F. otherwise.
SO_BROADCAST .T. if socket can send broadcast messages, .F. otherwise.
SO_DEBUG .T. if debugging information is recorded, .F. otherwise.
SO_DONTLINGER .T. if pending data is discarded on close, .F. otherwise.
SO_KEEPALIVE .T. if keepalives are sent, .F. otherwise.
SO_LINGER 2-element array of linger parameters: {lOnOff, nTimeOut}.
SO_OOBINLINE .T. if out-of-band data is included in regular data stream, .F. otherwise.
SO_RCVBUF Numeric buffer size for receive operations.
SO_REUSEADDR .T. if local address reusage is enabled, .F. otherwise.
SO_SNDBUF Numeric buffer size for send operations.
SO_TYPE Numeric value indicating type of socket (SOCK_STREAM or SOCK_DGRAM).

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


SocketGetOption() retrieves the current value for a socket option associated with a socket of any type, in any state, and stores the result in the parameter<xValue>.


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.