TCP

Function

Run simple tests or command sequences against a TCP port. Check if a TCP port is open.

Alarming

Connection time, Transfer time, Sequence

The Transmission Control Protocol (TCP) is one of the core protocols of the Internet protocol suite. TCP provides reliable, in-order delivery of a stream of bytes, making it suitable for applications like file transfer and e-mail. It is so important in the Internet protocol suite that sometimes the entire suite is referred to as "the TCP/IP protocol suite." TCP is the transport protocol that manages the individual conversations between web servers and web clients. TCP divides the HTTP messages into smaller pieces, called segments, to be sent to the destination client. It is also responsible for controlling the size and rate at which messages are exchanged between the server and the client.

The Internet Protocol (IP) works by exchanging groups of information called packets. Packets are short sequences of bytes consisting of a header and a body. The header describes the packet's destination, which routers on the Internet use to pass the packet along, generally in the right direction, until it arrives at its final destination. The body contains the application data.

In cases of congestion, the IP can discard packets, and, for efficiency reasons, two consecutive packets on the Internet can take different routes to the destination. Then, the packets can arrive at the destination in the wrong order.

The TCP software libraries use the IP and provide a simpler interface to applications by hiding most of the underlying packet structures, rearranging out-of-order packets, minimizing network congestion, and re-transmitting discarded packets. Thus, TCP very significantly simplifies the task of writing network applications.

TCP detail

TCP parameters

Parameter

Description

Port

Enter the TCP port which should be tested

Sequence

A sequence of Send and Expect commands can be specified for extended application testing. Send sends a command, Expect waits for a specific expression from the remote host. See example below.

Regular expressions (perl) can be used for Send and Expect fields (.* = any character). See the following link for some examples: http://www.boost.org/doc/libs/1_34_1/libs/regex/doc/syntax_perl.html

TCP values and alarm limits

Value / Alarm limit

Description

Connection time

Time to connect to the TCP port

Transfer time

Time to transfer the data

Sequence

Check if the specified sequence returned any errors in all steps or a specific step.

Error code

Generic job error code (see section Job error codes)

TCP examples

Example 1 - Check if TCP port 443 is open on a device, without specifying a sequence

Port

443

Output 1

Example 2 - Test a connection sequence to an FTP server

The following sequence against a public FTP server (speedtest.tele2.net) tries to log in using an anonymous account, then it lists the current directory and quits:

The expected text strings are best tested on the Linux command line using the telnet command:

$ telnet speedtest.tele2.net 21
Trying 90.130.70.73...
Connected to speedtest.tele2.net.
Escape character is '^]'.
220 (vsFTPd 2.3.5)
user anonymous
331 Please specify the password.
pass anonymous
230 Login successful.
pwd
257 "/"
quit
221 Goodbye.
Connection closed by foreign host.

Now the expected text can be entered into the job's sequence. Make sure to escape special characters with a backslash (e.g. the brackets).

Append \r\n to each sequence item, which means a carriage return.

Output 2