Due: 9/23/99 CS 629: HW # 1 Points 40 Group Size LE 4
Objective of this assignment
Client server communication.
Understand underlying interactions
Become familiar with system calls
Establish client/server communication
Write a Finger client. It talks to well known finger server (79/tcp).
Finger a user on host name. User and hostname given as command line arguments.
Print on client window the response it receives.
Here are my client server routines that you might use
int socket (AF_INET, SOCK_STREAM, 0): Allocate a socket and return
the socket number. The returned value is
used as the first parameter in the next set of routines.
int connectToHost (int socketNO, char * serverMachineName, int serverPortNO):
connect to the server host given by serverMachineName (eg. "sigma")
which is on port number serverPortNO. The call blocks. Returns
< 0 upon error.
int read (socketNO, FromServer, maxLength)): Read (up to maxLength bytes) from
the server and store it in FromServer. Actual # bytes read is returned.
The call blocks.
int write (int socketNO, ToServer, int lengthOfToServer):
Write to the server lengthOfToServer bytes from the array ToServer. Returns < 0 upon error.
int close (int socketNO): close the connection. Returns < 0 upon error.
int buildServer(int socketNO, 0): server establishes itself at a port.
Prints the port it is available on.
int listen(int socketNO): server waits for client connections
to come in.
int matchWithClient (int socketNO):
Returns a connectionNO that the server can talk to with the
'just connected' client.
The server may use read and write on this connection number.
These are provided as a library, in alpha: /home/cs/cs629/c++cltMod.o,
c++serMod.o, and clientServer.h header file
Notes
You don't use server routines since you don't write server!
Read the RFC 1288 for finger protocol from web page.
Finger is simple. Use telnet hostname 79 to learn about it.
May also see section 4 of RFC 1288 for practical examples.
include sys/types.h; sys/socket.h; "/home/cs/cs629/clientServer.h"
How to compile your client, Client1.cpp? cxx Client1.cpp /home/cs/cs629/c++cltMod.o -o
client
Create a
readme1 file.
Run the program for a variety of inputs.
Hand-in a printed copy of readme1 file, program listing, input, output.
Each team member provides a summary of everyone's contribution.