Netcat

'Swiss-army knife' for TCP/IP

The PC utility Netcat is known as the "Swiss-army knife" for TCP/IP. Source code and Windows executable are located in the Support SW directory \D.SignT\Utilities. Netcat lets you easily check UDP and TCP connections. Some of the netlib examples require a netcat terminal for testing.

External links:

Installation

Copy the Windows executable nc.exe to your PC and add this directory to your environment path variable or use setup_netcat.exe from the utilities directory. setup_netcat.exe is executed automatically, if you use a D.SignT installer for the netlib support SW.

Parameters

Netcat is a command line tool which requires some parameters to work properly. Use nc -h for a list of possible parameters.

nc_h.jpg

The required parameter list for each example is mentioned in the examples source code.

E.g. example nettest. First run the DSP program nettest.out. Start a console window and try to ping the DSP. If all settings are right, the pings should be replied. Then start a UDP netcat session with

>nc -u 192.168.168.200 7

Parameter description:

  • "-u" - start a UDP session
  • "192.168.168.200" - DSP IP address, must match the IP address configured in netconfig.c
  • "7" - echo port the DSP is listening on

All characters you type in the console should be echoed after pressing the enter key:

nc_udp_echo.jpg

For the TCP test press ctrl - c to stop netcat and start a new netcat session with the following parameter:

>nc 192.168.168.200 1061

Parameter description:

  • "192.168.168.200" - DSP IP address, must match the IP address configured in netconfig.c
  • "1061" - TCP port the DSP is listening on

Type in 15 characters and press enter:

nc_tcp_1.jpg

The DSP answers with message "this is the DSP response". If you enter more than 15 characters you will observe two DSP answers:

nc_tcp_2.jpg

This effect is due to the configured TCP buffer size of 16 characters on the DSP. TCP always takes care of the receivers buffer size. If more bytes than the maximum buffer size have to be transmitted, TCP splits the data stream into suitable packets.