Use the procedure shown in Figure 1 to
set an option for a TCP connection.
Figure 1. TcpOption example procedure TcpOption
(
Connection: ConnectionType
OptionName: integer
OptionValue: integer;
var ReturnCode: integer;
); external;
- Parameter
- Description
- Connection
- The connection number, as returned
by TcpOpen or TcpWaitOpen in the Connection field of the StatusInforType
record.
- OptionName
- The
code for the option.
- Name
- Description
- OPTIONtcpKEEPALIVE
- If OptionValue is nonzero, then the keep-alive mechanism is activated
for connection. If OptionValue is 0, then the keep-alive mechanism
is deactivated for the connection. When activated, the keep-alive
mechanism periodically sends a packet on an otherwise idle connection.
If the remote TCP does not respond to the packet or to retransmissions
of the packet, then the connection state is changed to NONEXISTENT,
with reason TIMEOUT connection.
- OptionValue
- The
value for the option.
- ReturnCode
- Indicates success or failure of call.
Possible return values are:
- OK
- NOsuchCONNECTION
- NOTyetBEGUN
- TCPipSHUTDOWN
- INVALIDrequest
- SOFTWAREerror
- REMOTEreset
For a description of Pascal return codes, see Table 1.