![background image](http://html1.mh-extra.com/html/patton-electronics/etherbits-2211/etherbits-2211_getting-started-manual_4062529044.webp)
TCP Client Mode Operations
44
Models 2211 & 2232 Getting Started Guide
5 • Host Mode configuration
data through the serial port during the specified inactivity timeout interval, the existing TCP connection will be
closed automatically.
If the value of inactivity timeout is set to 0, the current TCP connection is maintained unless there's no connec-
tion close request. Although inactivity timeout is disabled, the device server will check the connection status
between the device server and the remote host by sending “keep alive” packets periodically. If the remote host
does not answer the packets, it is regarded that the connection is down unintentionally. Then, the device server
will force to close the existing TCP connection.
Note
At least, this value should be set larger than that of inter-character timeout. To
prevent the unintended loss of data due to the session disconnection, it is
highly recommended that this value is set large enough so that the intended
data transfer is completed.
The following example shows how to set TCP server mode:
> set host tcps 6001 300
OK
>
TCP Client Mode Operations
The device server works as a TCP client, and the default TCP state is [Closed] in this mode. The remote host
will be either Ethernet-Serial communication devices acting as a TCP server or a socket program acting as a
TCP server running on users' PC.
1) Typical State Transition
[Closed] --> [Sync-Sent] --> [Established] --> [Data] --> [Closed]
At start-up, an initial TCP state is [Closed]. If there is any incoming data through the serial port, the device
server will try to connect to a user-defined remote host. Then, the state will be changed to [Sync-Sent], which
means the connection request is being sent. If the remote host accepts the request, the state will be changed
into [Established], which means a session has been opened. For a while, data will be transferred between the
hosts. This is [Data] state. The session will be disconnected due to the request of one of them, which is its orig-
inal state, [Closed].
2) Operations
Serial data transfer
Whenever the serial device sends data through the serial port of the device server, data will be accumulated
to the serial port buffer of the device server. If the internal serial port buffer is full or inter-character time
interval reaches to the time specified as inter-character timeout value, it tries to connect to the user-defined
IP address of the remote host, if TCP session is not established yet. If the device server successfully con-
nects to the remote host, the data in the serial port buffer will be transferred to the host. Otherwise, all the
data stored in the buffer will be cleared.