Using TTYredirector

Technical Notes

Restoring Failed Connections

The -restore option is enabled to make TTYredirector attempt to restore a failed network connection to a device server.

When the -restore option is set to N:

  • TTYredirector takes no independent action to re-establish a failed connection.

  • The connection to the server will not be restored until the application closes and reopens the tty device.

When the -restore option is set to Y:

  • When TTYredirector notices that the TCP connection is broken, it will immediately attempt to reconnect to the device server.

  • If that attempt fails, TTYredirector tries again at increasing intervals until the connection is restored or the application closes the tty device.

  • The maximum interval between attempts is determined by the setting of the advanced option -maxreconnect.

The -restore option should be used if the application can continue normal operation if a failed connection is automatically restored. Whether this is possible depends on:

  • What has happened on the server when the connection failed? Is the device still in an operable state?

  • If TTYredirector reconnects, will it get the same device?

  • Can the application tolerate a delay in detecting the failed connection and the time it takes to reconnect?

The Keepalive Interval

One of the basic characteristics of a TCP/IP connection is that one end of the connection may fail without automatic notification to the other end.

If the -restore option is enabled on any TTYredirector tty devices, and if Telnet with RFC 2217 extensions protocol is being used, the TTYredirector periodically emits a "keep-alive" message to the server, which responds with an acknowledgement. This action monitors the existence of the connection. The interval between attempts by the redirector to reach the server is 60 seconds by default. This means that as much as 60 seconds may elapse before the redirector discovers that the connection has failed.

To shorten the maximum time of an undetected failure, a smaller value for the keepalive interval can be used by change the setting of the -keepalive option. The penalty of shorter intervals is increased network traffic and overhead on the local computer and server.

Limiting the Data Rate

Because TTYredirector is relaying data to the server over a network connection, the rate at which it sends data to the server can be network speed until various buffers fill in the local computer, the network, and/or the server software. Consequently, the application using TTYredirector may incorrectly assume that all data has been sent by the serial device because all writes to the local TTYredirector tty device have completed. This is not a problem for most applications.

If the server supports the Telnet protocol with RFC 2217 extensions, the server is able to exercise control over the rate at which the redirector sends data. Otherwise, if the -limitrate option is disabled, TTYredirector ignores that baud rate setting and lets the server accept data as quickly as it can.

The Nagle Algorithm

The purpose of the Nagle algorithm is to provide better network efficiency while imposing a minor latency on the data stream while it waits to fill network packets. For most applications, this effect is transparent.

For applications that are especially sensitive to data timing, however, the Nagle algorithm may cause application errors that can be solved by disabling the -nagle option. Examples include applications that send short messages and wait for an acknowledgement.

Command Status Values

The following error numbers can be returned by trconfig, trquery and trtrace.

0 The specified option wasn't recognized.  I.e., "trquery -foobarbaz".
1 An option was recognized, but it was being used out of context. An example is a command that contains -tty (valid for tty configuration options) along with a general configuration option like -keepalive.
2 A value is illegal. An example is "trconfig -tty "nonsense value".
3 The command has been rejected by the TTYredirector daemon. An example is setting a user permission for a user that doesn't exist.
4 The command program is unable to communicate with the ttyredirectord daemon.