User manual

Notes concerning the
communication protocol TCP
6 © 2007-2010 Analytica GmbH
To amend this problematic nature TCP provides an internal keep alive mechanism. Keep-alives are special
data packets which are sent in regular intervalls between the two endpoints of an opened communication
channel. The recipient of a keep-alive packet has to confirm the receipt to the sender within a certain period
of time. Are there no keep-alives or confirmations of keep-alives receivedm the communication partner
assumes that the channel is interrupted or the corresponding socket is malfunctioning.
The keep-alive mechanism of TCP is not active per default and has to be activated by the setsockopt
function for each connection. The API functions which establish a connection to an AnaGate - like the
CANOpenDevice() function - strictly activate the keep-alive mechisam of TCP.
Note
On Windows operating systems some settings concerning keep-alives can be set individually.
These settings are valid for all network connection on this computer and can not be set
individually for dedicated connections.
To do so the Windows registry keys KeepAliveTime and KeepAliveInterval of node
\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Tcpip\Parameters
has to be adjusted (administrator rights).
Especially the CAN-Ethernet gateways can be affected by the above described problems, for example
if customer-specific needs ask for faster detection of connection aborts as possible via the standard
mechanism. So, in the AnaGate models with CAN interface and linux OS an application-specific keep-
alive algorithm is integrated in the device firmware to enhance connection control. On base of a predefined
time period additional data packets are exchanged between the AnaGate hardware and the controlling
unit/personal computer, which have to be confirmed by the corresponding endpoint (ALIVE_REQ,
[TCP2010]). This integrated alive machanism can be activated individually on each connection with a
different timeout interval.
Note
Users of the AnaGate-API do not have to implement the application-specific alive
mechanism to use it. With a simple call to the API function CANStartAlive a concurrent
thread is started which automatically monitors the communication channel time-controlled.