CSE342 - Lab 3: TCP-based Applications

Purpose: Gain experience with programming TCP-based network applications.

finger is a client program that contacts a finger server to display information about users. The client can contact a server running locally (on the same machine as the client) or one running on a remote machine over the network. For those not familiar with the finger service, read the finger(1) man page and try out the Solaris finger client utility yourself.

EXERCISE: Write a TCP client program that contacts a finger server to obtain information about a computer user account.

Your program will:

  1. Accept an optional command line argument to specify the remote host and user account to query. Example: ./myfinger jupiter.cse.lehigh.edu brian

  2. Use the finger protocol (as specified in RFC 1288) to send the query to the remote host. If no remote host is specified, use localhost. If no user name is specified, send a null query.

  3. Print to standard output any response from the finger server.

You might want to consider the sample TCP echo client code we used in chapter 2 as a starting point. However, your code should include more comments and error checking!

You might also want to review chapter 2 of your TCP/IP Sockets in C reference book, as it helps explain datatypes like sockaddr, sockaddr_in, in_addr, and sockaddr_in.


Last revised 8 September 2009.