Skip to main content
留学咨询

辅导案例-CISC 435-Assignment 3

By May 15, 2020No Comments

CISC 435 – Fall 2019 Programming Assignment 3/3 © Dr. Sameh Sorour 1 of 4 CISC 435 – Computer Networks – Fall 2018 Programming Assignment 3/3 Due December 6th, 2019 23:59 • This is an individual project – you cannot work as groups. Plagiarism in any form will be treated as per “Queen’s University Academic Integrity guidelines” • Use either Java, C/C++, or Python only. Java is preferred for better support. • Use the same language (the one you picked from the above list) for all codes across the entire assignment • The source code is to be uploaded to OnQ. Deliverables 1. Report, detailing: a. Brief description of the code steps, operation, and considerations (if any). b. Difficulties you faced and how you handled them (if you faced no difficulties discuss the scalability of your app and how you designed for it) c. Possible improvements: If you had more time, what would you add or do differently? 2. Source file (Use comments to document/describe your code) CISC 435 – Fall 2019 Programming Assignment 3/3 © Dr. Sameh Sorour 2 of 4 Description In this assignment, you will learn to implement connection establishment and reliable data transfer (rdt) for applications running over UDP. As you recall from lectures, UDP is a best-effort transport layer protocol that does not establish connections before transferring packets nor tracks whether they have arrived properly to their destination. Yet, many applications still employ UDP for its benefits explained in class. If needed, these application designers must assume the responsibility of implementing the above two functions (i.e., connection establishment and rdt) in the application layer. You will be required to create a chatting application that establishes connections between clients and exchanges messages reliably. The components of the system running this application are shown in Figure 1. As shown, it consists of 4 clients and 1 server. When each of the clients is run, it opens a UDP socket and informs the server about the IP address and port number it can be reached at. When a client wants to send data to another, it first consults with the sever to know the port number it can be reached at, establishes an application-layer connection with it, then starts chatting. Once done, either party can initiate an application-layer termination of the chatting session. A client can always quit the application by notifying the server then closing the UDP socket. All above message exchanges must be acknowledged by the application layer to ensure rdt. In this assignment and for the sake of simplicity, you will create the 4 clients and the server on the same machine. Since all elements will be on the same machine (same IP address), you will use the port number to distinguish between the processes. IP addresses do not need to be registered in the server nor used in the message exchanges. Requirements The following is a list of the design requirements of the application. All steps (including starting server and clients, sending connection requests, accepting/rejecting connections, exchanged messages, connection terminations, etc.), must be made printable on the command line for normal application usage and code testing. 1. When started, the application server must create a UDP socket that listens on port 7070. The server must be able to handle multiple clients concurrently. Figure 1: Chatting Application Component Server Client 1 Client 2 Client 3 Client 4 Client Port No. 1 A 2 – 3 C 4 D CISC 435 – Fall 2019 Programming Assignment 3/3 © Dr. Sameh Sorour 3 of 4 2. Upon starting, any client must establish a UDP socket and send its port number to the application server at “localhost:7070”. The list of clients that are active on the application and their reachable port numbers must be automatically displayed upon any change (any joining or leaving client) on the Server’s command line. 3. For any client X to establish a connection to another client Y, it must follow the following procedure: a. User running Client X uses the command line to prompt the sending of a message to the server at “localhost:7070” asking about the UDP port number of Client Y. b. If Client Y is active (the server has a UDP port number for it), the server returns the port number to Client X. If not, the server returns a “Client Y Inactive” message to Client X. c. If Client X receives a port number for Client Y, it sends a “Connection Request” message, sets a 10-seconds timer, and waits for a response. The “Connection Request” message must have a numerical identifier for Client X (say no. X). If no “Connection Accept” nor Connection Reject” is received from Client X within 10 seconds, Client X resends the “Connection Request” message again and repeats the procedure until it gets one of these two messages. d. Once Client 2 receives the “Connection Request” message, it displays a message on the commend line for the user to accept or reject the connection. i. If accepted. Client 2 responds with a “Connection Accept” message. ii. If rejected, Client 2 responds with a “Connection Reject” message. In either case, the message must have a numerical identifier for Client Y (say no. Y). 4. When a connection is established between two clients, they can send short messages to one another through their command lines, which should be displayed on each other’s’ command lines. The messages sent by each client should include its identifier. They must also be sequenced incrementally and each of them must be acknowledged by the other party (using its sequence number) within 10 seconds, or else sent again. Duplicate messages (detected by duplicate sequence numbers) must be discarded and not displayed again. 5. Either clients can send a “Connection Termination” messages to the other, which if acknowledged, must result in connection termination (again displayed in the command line). 6. To quit the application, a client must send a “Client Leave” message to the server. Once received the server erases the UDP port number from its table and sends an acknowledgement to the client. Only then, the client executes a socket close command. Bonus: Clients must be able to handle multiple chats with multiple other clients. The client identifiers can be used to differentiate between messages coming from different clients. If there is a detail not included in the requirements above, then it is totally up to you to decide on. All your design considerations must be detailed in the report. In the “future work” section, you can detail all the things you might want to do if you had the time. Rubric Project (No partial credit under each item, it is either fully met or receives no points) 1. Program can create server and clients 1 point 2. Created clients successfully send port numbers to server 1 point 3. Server automatically displays the list of active clients upon any change 1 point 4. Client receive “Client Inactive” messages from server for inactive clients 1 point 5. Clients successfully establish connections to one another 1 point CISC 435 – Fall 2019 Programming Assignment 3/3 © Dr. Sameh Sorour 4 of 4 6. Clients can reject connection requests from one another 1 point 7. Clients sending messages with incremental sequence numbers 1 point 8. Received messages are acknowledged 1 point 9. Clients successfully close connections 1 point 10. Clients successfully leave the application 1 point 11. Bonus: Client exchanging messages with multiple clients 2 points Sample test cas
es Make sure to test all items in the rubric.

admin

Author admin

More posts by admin