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:
program
[remote-host [user-account]]
dactyl.cse.lehigh.edu
. If no
host specified, use localhost
(which always
refers to the
same machine on which you are running).
brian
.
./myfinger jupiter.cse.lehigh.edu brian
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.
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.