Objectives:
- Implement a client-server network application
- Learn to use the sockets API
- Use the TCP protocol
- Refresh programming skills
The Program:
Design and implement a simple chat system that works for one pair of users, i.e., create two programs: a chat server and a chat client. The final version of your programs must accomplish the following tasks:
- chatserve starts on host A.
- chatserve on host A waits on a port (specified by command-line) for a client request.
- chatclient starts on host B, specifying host As hostname and port number on the command line.
- chatclient on host B gets the users handle by initial query (a one-word name, up to 10 characters). chatclient will display this handle as a prompt on host B, and will prepend it to all messages sent to host A. g., SteveO> Hi!!
- chatclient on host B sends an initial message to chatserve on host A : PORTNUM. This causes a connection to be established between Host A and Host B. Host A and host B are now peers, and may alternate sending and receiving messages. Responses from host A should have host As handle prepended.
- Host A responds to Host B, or closes the connection with the command quit
- Host B responds to Host A, or closes the connection with the command quit
- If the connection is not closed, repeat from 6.
- If the connection is closed, chatserve repeats from 2 (until a SIGINT is received).
Requirements:
- chatserve must be implemented in Java or Python
- chatclient must be implemented in C/C++.
- Of course, your program must be well-modularized and well-documented.
- Your programs must run on an OSU flip server (for example: flip1.engr.oregonstate.edu). Specify your testing machine in the program documentation.
- Your programs should be able to send messages of up to 500 characters.
- Use the directories in which the programs are running. Dont hard-code any directories, since they might be inaccessible to the graders.
- Be sure to cite any references, and credit any collaborators.
- Provide a README.txt with detailed instructions on how to compile, execute, and control your program.
- Combine all program files into one *.zip archive (no .7z or .gz allowed). The .zip file should not contain any folders only files!
page 1 of 2
Notes:
- For your C implementation, read Beejs Guide. It has everything you need for this assignment. You will probably learn the most about socket programming by using C.
- If you are using Python, check http://docs.python.org/release/2.6.5/library/internet.html,
- If you are using Java, check http://docs.oracle.com/javase/tutorial/networking/sockets/index.html.
- Its OK to hard-code host As handle.
- Its OK to implement this system so that it requires the two users to take turns sending messages, i.e., when a user sends a message, s/he must wait for a response before sending the next message.
- When debugging, dont use the well-known port numbers, because these will already be in use. Id suggest using 30020 or 30021, though other students may be using these when youre on the servers.
- If you use additional include-files or make-files, be sure to include them in your .zip file.
- You can test these programs using just one computer. Start the server, then start the client in a new window. You can then switch back and forth between the two terminal windows.
- Project #1 will be accepted up to one week late with a penalty of up to 10% per day.
Extras:
- If you implement extra credit features, be sure to describe those features in your program documentation and README.txt or you will not receive any credit.
- There are many possibilities for extra credit. Be sure that your program satisfies the requirements first, and then do the extra credit in separate files.
- Extra credit possibilities include (but are not limited to) Set up your programs so that either host can make first contact.
- Make it possible for either host to send at any time (while the connection is active) without taking turns.
- Make your server multi-threaded.
- Split the screen to show host Bs typing in one panel, and host As responses in the other panel.
- Make the characters appear on the receiving host as they are being typed on the sending host (instead of waiting for the entire line to be sent).

![[Solved] CS372 Project 1](https://assignmentchef.com/wp-content/uploads/2022/08/downloadzip.jpg)

![[Solved] C S 372 -Lab 4 Constructing and visualizing graphs](https://assignmentchef.com/wp-content/uploads/2022/08/downloadzip-1200x1200.jpg)
Reviews
There are no reviews yet.