CS87 Lab 2: Part1 Sample Output

This example shows client and server ouput form a session where first one client program connects and talks with the server and quits, and then another client program connects and talks with the server (note: the server program stays running and just accepts the next connection what the current talk session is completed).

The client and server take turns initiating the MSG protocol sending and receiving strings back and forth. Each program reads in the next string to send to the other from the user. The client and server programs read in the next message string from the user, then send it to the other party using the MSG protocol.

In this example, the server is running on carrot and the clients are running on paprika.

You can use ifquery to list a machine's IP address, or nslookup to list the IP of another machine:

%  /sbin/ifquery eth0  # look at the address entry

% nslookup lime  # list lime's IP address

output from two runs of the client connecting to the server on carrot

Note that the string received by the server is shown in bold, the client program prints out a prompt ($:) and the string after is what the user enters:

paprika % ./cs87_client 130.58.68.67 tia

you are going to connect to the talk server on 130.58.68.67
enter next message at the prompt, enter goodbye to end

Connected.
$: hello there
hi tia
your msg: hi server, do you have any licorice?
no, not really
$: it would be much cooler if you did
whatever
$: goodbye

I'm out of here
bye, bye

paprika %

paprika % ./cs87_client 130.58.68.67 elmo

you are going to connect to the talk server on 130.58.68.67
enter next message at the prompt, enter goodbye to end

$: hello there
hi elmo, what can I do for you?
$: well, nothing.  I'm just saying hi
okay, hi back.
$: okay, so long
bye
$: goodbye

I'm out of here
bye, bye
paprika %

Output from the server side

Here is the server's output from this exchange (the server's prompt is "$:" followed by the input entered by the user). The server prints out when it accepts a new TCP connection and when a new client has passed the HELLO protocol, and when the client QUITS and when the server closes the TCP connection to send this session. The received client messages that it prints to stdout are shown in bold (note: the user name prefix)
carrot % ./cs87_server

Accepted new client socket.
New client (tia) passed HELLO check.
tia:hello there
$: hi tia
tia:hi server, do you have any licorice?
$: no, not really
tia:it would be much cooler if you did
$: whatever
client QUIT
server ending connection

Accepted new client socket.
New client (elmo) passed HELLO check.
elmo:hello there
$: hi elmo, what can I do for you?
elmo:well, nothing.  I'm just saying hi
$: okay, hi back.
elmo:okay, so long
$: bye
client QUIT
server ending connection