KeepAlive Property  
 

Set or return if keep-alive packets are sent on a connected socket.

Syntax

object.KeepAlive [= { True | False } ]

Remarks

Setting the KeepAlive property to a value of true indicates that packets are to be sent to the remote system when no data is being exchanged to keep the connection active. This property can only be set for stream sockets that were created with the Protocol property set to a value of swProtocolTcp.

If this property is set to true, keep-alive packets will start being generated five seconds after the socket has become idle with no data being sent or received. Enabling this option can be used by applications to detect when a physical network connection has been lost. However, it is recommended that most applications query the remote host directly to determine if the connection is still active. This is typically accomplished by sending specific commands to the server to query its status, or checking the elapsed time since the last response from the server.

Data Type

Boolean

See Also

Broadcast Property, InLine Property, NoDelay Property, Protocol Property, ReuseAddress Property, Route Property