The nc(1) utility, which is also called netcat(1), comes in very handy when you want to test TCP/IP servers and clients. This section will present some of its more common uses.
You can use nc(1) as a client for a TCP service that runs on a machine with the 10.10.1.123 IP address and listens to port number 1234, as follows:
$ nc 10.10.1.123 1234
By default, nc(1) uses the TCP protocol. However, if you execute nc(1) with the -u flag, then nc(1) will use the UDP protocol.
The -l option tells netcat(1) to act as a server, which means that netcat(1) will start listening for connections at the given port number.
Finally, the -v and -vv options tell netcat(1) to generate verbose output, which can come in handy when you want to troubleshoot network connections.
Although netcat(1) can help you to test HTTP applications, it will be niftier in Chapter 13...