CS87 Lab 2: Part2 Sample Output

This example shows the Part2 server and 3 client's connected to a chat session. The clients can initiate the MSG protocol at any time. The server on receipt of a message, forwards it to all clients currently in the chat; the server is not a participant in the chat. Clients can join and leave the chat at any time.

Note that the server sends each client's message to the others with the client's name as a prefix: "mo: hello?". Also note that the prompt printing ($:) on a client can get oddly interleaved with the output of messages from other clients. You are not required to fix this oddness, but if you want to try to make the client side look better, one way is to use ascii escape codes to print the messages from other clients in a different font color(s) so that it is easier to differentiate a client's input and other's output. For some examples, see: ascii escape codes. You could also try something more elaborate using ncurses (see: cool C libraries for some links to ncurses). One idea is to use ncurses to split the screen in half with the client program's input (stdin) in the bottom half, and the program's output (stdout) in the top.

output from server running on eagle, with three clients connecting and chating

Messages received by the client that it prints out are shown in bold. The output may look a bit odd because the server a message it recieves to all other clients, including the one from whom it received the message, and the clients just print out any message the receive from the server including ones from themselves, but this is okay/fine output.
======================================
Server output:
======================================
eagle% ./cs87_server
Accepted new client socket.
New client (mo) passed HELLO check.
Accepted new client socket.
New client (freya) passed HELLO check.
Accepted new client socket.
New client (jake) passed HELLO check.

======================================
Client 1's output:
======================================
bluejay% ./cs87_client 130.58.68.210 mo
Hello mo, you are trying to connect to talk server 130.58.68.210
enter next message at the prompt or goodbye to quit

Connected.
$: hello?
mo: hello?
$: is anybody out there?
mo: is anybody out there?
$: freya: hello, who is there?
hi Freya I'm here (mo)
mo: hi Freya, I'm here (mo)
$: freya: hi mo, do you have any licorice?
jake: hello there
jake: is anybodyout there
freya: hi jake this is freya, I think mo is here too
hi freya 
mo: hi freya
$: goodbye
Sending QUIT!
bluejay% 
======================================
Client 2's output:
======================================
pimento%  ./cs87_client 130.58.68.210 freya
Hello freya, you are trying to connect to talk server 130.58.68.210
enter next message at the prompt or goodbye to quit

Connected.
$: hello, who is there?
freya: hello, who is there?
$: mo: hi Freya, I'm here (mo)
hi mo, do you have any licorice?
freya: hi mo, do you have any licorice?
$: jake: hello there
jake: is anybodyout there
hi jake this is freya, I think mo is here too
freya: hi jake this is freya, I think mo is here too
$: mo: hi freya
hi mo
freya: hi mo
$: mo?
freya: mo?
$: mo, are you there mo?
freya: mo, are you there mo?
$: goodbye
Sending QUIT!
pimento% 
======================================
Client 3's output:
======================================
duck%  ./cs87_client 130.58.68.210 jake
Hello jake, you are trying to connect to talk server 130.58.68.210
enter next message at the prompt or goodbye to quit

Connected.
$: hello there
jake: hello there
$: is anybodyout there
jake: is anybodyout there
$: freya: hi jake this is freya, I think mo is here too
mo: hi freya
freya: hi mo
freya: mo?
freya: mo, are you there mo?
hello???
jake: hello???
$: goodbye
Sending QUIT!
duck%