CSC339 - Revised LAB Assignment 2

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

COMSATS University Islamabad (CUI)

Department of Computer Science


CSC339- Data Communication and Computer Networks
BSE-5B
Lab Assignment #2 Fall 2021
____________________________________________________
Instructions

 Your assignment should be submitted in soft form via CU online portal.


 There is a zero-tolerance policy for plagiarism. Assignments found with copy pasted
material or copied from fellows will not be accepted.
 Submission Deadline for assignement-2 is November 1, 2021.
______________________________________________________________________________

Task 1 (5 Marks)
Write a chat room application that allows multiple users to connect to the chat server. Before
the user is able to see the chat window, each user needs to enter his or her name. Once a user is
connected, the server window has to display a connected message with the user’s address. The
user’s chat window should display a welcome message form the server. The chat window
should include a message panel to display chat history. Below the chat panel, there should be a
profile picture, a text field for user to type messages and a send button for sending messages to
other connected users. In addition, there should be a setting button, an image button and an
upload button. Setting button allows the user to change the background colour. Image button
allows a user to select files from the computer. The upload button allows the user to upload the
selected image file to the server. The server saves the image at a file named “image.jpg”. In the
user’s chat panel, each message should display the user’s name followed by the typed message.
Please show screen shot of the server window, and three user chat windows. Three users are
“Jay”, “Sam” and “Collen.” Please see the result sample in the attached image.
Task 2 (5 Marks)

Please build a simple client-server system, where you use the client to chat with a dummy "math"
server. The protocol between the client and server is as follows.

The server is first started on a known port.


The client program is started (server IP and port is provided on the command line).
The client connects to the server, and then asks the user for input. The user enters a
simple arithmetic expression string (e.g., "3 + 5", "8 - 6", "3 * 4"). The user's input is sent
to the server via the connected socket.
The server reads the user's input from the client socket, evaluates the expression, and
sends the result back to the client.
The client should display the server's reply to the user, and prompt the user for the next
input, until the user terminates the client program with Ctrl+C.

You might also like