The soConfigGet function retrieves the current value of a socket option that can be set with soConfigSet.
The available options are:
option
|
data type
|
description
|
_SO_OPTION_ACCEPTCONN
|
BOOL
|
Query if the socket has been marked to accept incoming connections.
|
_SO_OPTION_BROADCAST
|
BOOL
|
Query if the socket are allowed to send data to a broadcast address. (_SO_PROT_UDP only)
|
_SO_OPTION_KEEPALIVE
|
BOOL
|
Query if keep-alive messages are enabled in the socket (_SO_PROT_TCP only)
|
_SO_OPTION_LINGER
|
soOptionLinger
|
Query if the socket should linger when closed. (_SO_PROT_TCP only)
|
Input:
socket : SYSHANDLE
Handle to the socket.
option : INT
The option to query.
data : PTR
A pointer to a buffer where the option data is stored.
Returns: INT
1
|
- Success.
|
0
|
- The function is not supported.
|
-1
|
- The handle is not a valid socket.
|
-2
|
- One or more parameters are illegal.
|
-3
|
- The socket is closed.
|
-5
|
- The socket does not support this action.
|
-17
|
- Generic error.
|
Declaration:
FUNCTION soConfigGet : INT;
VAR_INPUT
socket : SYSHANDLE;
option : INT;
data : PTR;
END_VAR;
Example:
INCLUDE rtcu.inc
PROGRAM example;
VAR
handle : SYSHANDLE;
val : BOOL;
rc : INT;
END_VAR;
BEGIN
...
rc := soConfigGet(
socket := handle,
option := _SO_OPTION_ACCEPTCONN,
data := ADDR(val)
);
DebugFmt(message := "soConfigGet=\1 accept=\2", v1 := rc, v2 := INT(val));
...
END;
END_PROGRAM;
|