Installing Stevens' sock program

 

Richard Stevens uses a generic program called sock.c in his TCP/IP Illustrated book. Its purpose is to generate TCP and UDP data for testing various network features of interest. It runs as either client or server. Stevens used it in versions of UNIX. There are linux versions at the T/TCP  site, and a "dusted off and updated" version in source code by Christian Kreibich. Download the latter, or get it by anonymous ftp from the instructor-indicated server (named sock-0.3.2-1.x86_64.rpm or similar).


The assignment for you to perform

Log in as root and download Kreibich's version, or get it from the instructor-indicated server (under a name like sock-0.3.1.tar.gz). Unpack it:

tar -xzvf  sock-0.3.1.tar.gz

Drop down into the created directory:

cd  sock-0.3.1

Per the instructions in the INSTALL file,

./configure
make
make  install

Test sock in two terminal windows. In the first run it as a listening UDP server:

sock  -u  -s  5555

It waits. In the second run it as a client, against the server instance:

sock  -u 127.0.0.1  5555

It waits for input. Type something, followed by enter. Whatever you typed should appear over in the server's window. Terminate both instances with the ctrl-C key.

---------------------------------

We're done but please wait a moment. Before you go, here's a recapitulation using nc (netcat) because I want to point out the similarity between sock and the much better known nc.

Test nc in two terminal windows. In the first run it as a listening UDP server:

nc  -l  -u  -p 5555 

It waits. In the second run it as a client, against the server instance:

nc  -u 127.0.0.1  5555

It waits for input. Type something, followed by enter. Whatever you typed should appear over in the server's window. Terminate both instances with the ctrl-C key.