# eCos TCP/IP Networking Tests and Examples

A number of test/example programs are currently provided with the TCP/IP networking package. These are not "tests" in the traditional eCos test suite sense, but rather simple programs which exercise various parts of the networking stack. Also included are a set of performance tests, used to measure throughput and latency in an embedded eCos system.

The following paragraphs list the various tests and how they might be used. They are enumerated in the order in which they should be run to verify a system configuration.

Note: none of these tests are built by default. The user must enable the `CYGPKG_NET_BUILD_TESTS` option and then "`make tests`" to create them for the target environment. Also, these tests require that the hardware interfaces be configured to use either BOOTP or static initialization methods.

### mbuf_test.c

This should be the first test run on a new system. It simply tests that the networking system can be initialized and that the internal memory management (used by the stack) is functioning.

### socket_test.c

This test exercises some of the basic library interfaces.

### server_test.c

This test creates a server process on the target hardware which listens on port TCP/7734. To verify that it is working, try to connect to this port from some other [host] system. E.g. on Linux, use the command "`telnet eCos 7734`", where "`eCos`" is the name associated with the target hardware. Once connected, the eCos application will respond with a "Hello" message and wait for a single line of input text, which will be displayed on the diagnostic channel of the target system.

### ping_test.c

This tests attempts to issue an ICMP "echo" request to the "server" host (provided as part of the BOOTP or static configuration information). The output will be similar to the analogous Linux program, "`ping`". The test program also attempts to ping an additional host whose IP address is the server IP+32. This second test is present to verify that the ICMP (actually `receive`) time-out mechanism is working (assuming that the second host is non-existent).

### ftp_test.c

This test attempts to make a connection to an FTP server, assuming the default server host. This is an additional test which verifies that the basic TCP functionality is working.

### nc_test_master.c

### nc_test_slave.c

This pair of programs can be used to measure throughput and latencies in the target system. While both programs have been written in such a way that they can be built and used on either Linux or eCos, the primary use will be to run the "`nc_test_master`" program on a Linux host and the "`nc_test_slave`" on the target hardware. If run in this configuration, the master program will attempt to connect to the slave and make various measurements using both UDP and TCP protocols. Additionally, measurements will be made on an eCos slave of the actual CPU utilization by the networking stack.

To build the Linux versions, simply execute (in the eCos source tree, not the install tree):

> `make -f make.linux`

### tcp_echo.c

### tcp_sink.c

### tcp_source.c

This set of programs is similar to the `nc_test_XXX` programs described above. However, they are designed to measure overall throughput of the eCos system. The setup allows for one Linux host to run "`tcp_source eCos`" and another Linux host to run "`tcp_sink eCos`". The "`tcp_echo`" program is run on the target hardware. The tests then measure the throughput and latency of sending TCP data from one host, though the eCos target system and on to another host. Note: the two Linux host systems may be the same computer in which case this becomes a single wire echo test. This test suite is unique in that it attempts to load the target system down with additional background processing at various levels. This is done to simulate a real world environment where the networking is ancillary to the main processing on the target system.