Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

NOTE: Please, the code will be used for Windows not Lnux or another An on-line Chat System via Network Programming: In this project, you willdevelop

NOTE: Please, the code will be used for Windows not Lnux or another

image text in transcribed

An on-line Chat System via Network Programming: In this project, you willdevelop a simple online chat system using sockets in the C programming language. The systemwill consist of 2 modules:- Client module- Server moduleUsers should be able to send chat messages to each other in plain text using the client module.The server module will mediate the transmission and storage of messages. The server must beable to support multiple users to connect and send messages to each other at the same time. Thisassignment is similar to Question 4 in assignment 3, hence you can reuse the codes you havewritten previously; but with one important difference:If the receiver is online at the time of sending the message (connected to the server viasocket and logged in), the server should immediately forward the message to the receiverwithout waiting. The client, on the other hand, should be able to instantly display themessages that spontaneously come from the server, on the screen.For outgoing and incoming messages, some additional information should also be displayed; i.e.,for outgoing messages to whom it was destined to, and for incoming messages, the time ofreceiving the message and from whom it came should be displayed. For example, the screen flowafter a user starts the client, connects to the server, and logs in might look like this:Session StartedYou have no waiting messagesMessage sent to ali: Hello Ali, how are you?21:55:04-ali: thank you.If the recipient is offline, the server should store the message for later transmission. Storage ofthe messages need not be permanent; so you don't need to store messages in a permanent placelike a disk or database. There is no harm in deleting messages when the server application isshutdown and started again. Therefore, you can store pending messages in a suitable datastructure in memory.Initially the server must be up and running. Clients can connect, log-in and disconnect atdifferent times. The clients will always send the messages and initiate the dialog, while the server

will reply to the client appropriately. The client should display messages from other users on itsscreen, not server responses to his outgoing protocol message (except maybe the first responsemessage upon initial login).The protocol of the chat system will consist of the following messages (the same protocol as inthe 3rd Assignment 4th question, with the only difference that there is no POP_MESSAGEprotocol message in this protocol):BEGIN_SESSION :The client uses this message to log in. Server: Sends allpending messages (if any) in the user's mailbox to the client. If there are no pendingmessages, it will reply "You do not have any pending messages".SEND_MESSAGE : The client uses this command tosend a message. Server: "Your message has been received"END_SESSION : Client uses this protocol message to end its session with the server. Afterthis protocol message, the client closes its socket connection. The server does not need torespond to this protocol message.When a client sends anything other than the above protocol messages, the server shouldrespond with:Message Not UnderstoodOne particular point you should pay attention to while developing this application should be thatthe screen on the terminal where the user will perform operations such as logging in, sendingmessages and logging out, and the message texts that can be sent to him spontaneously by theserver should not be intertwined on the screen and should not interfere with each other.Otherwise, no one will want to use your app. You can go for a solution such as managing userinteractions, and messages coming from the server in different parts of the same terminal screen(in UNIX/Linux/MacOS systems it may require using one of the curses or ncurses libraries,which might be a bit tricky); or you can also choose an option such as redirecting them to twodifferent terminals, that is, while the user is managing his own interactions from one terminal, itshould be able to follow the messages coming from the server from another terminal. Thissecond terminal should also be opened by your program as soon as the client application isstarted, and spontaneous messages from the server to the client should be redirected to thissecond terminal, along with the relevant additional information (time, sender information,message text, etc.). For Unix/Linux/MacOS based systems, after getting the tty (teletypewriter)information of the second terminal (you can get this information with the help of "tty" and "#ps-u" commands via shell, we have seen before how shell commands can be run through execfamily system calls from within your program), you can open a file (FILE) in write mode withinyour program with the name of this tty (for ubuntu/Linux based systems, for example,/dev/pts/tty0, or /dev/pts/tty1, etc; it may be different in other Operating Systems!) Theresults of the standard print (fprintf, or write) actions performed towards this file shall be directeddirectly to that terminal. In this way, the user's inputs and the messages sent to him from otherusers will not interfere with each other.

Submissions and the Grading Specifications:1. Report (60%): The reports should be uploaded to Blackboard no later thanJanuary 8 midnight (23:59). Your reports shall contain at least the following threecomponents:a. A design guide (30%): start by a short introduction, followed byexplanation of your design and implementation (data structures used, howdid you implement the requirements stated above, etc.). Give reasons foryour design and implementation choices. There should be enough detailsin your report to explain everything. There is no such criteria as theminimum page count, its up to you to decide on how many pages youneed to explain things.b. A user manual including examples and screenshots (20%). You shouldinclude a screenshot of a sample run and its results for each and everycommand.c. All your code, supported with in-line comments (10%).2. Demo (40%). We are going to arrange proper time, and you are going to beasked to show off your project running. The demonstration will be done on-linevia a Zoom connection. You might also be asked questions about the specificdetails about your project, and codes also, during the demo session.Demonstration will be done as a group. Demonstrations will be held after theprojects are submitted, and before the final exam. Specific dates will beannounced later.

An on-line Chat System via Network Programming: In this project, you will develop a simple online chat system using sockets in the C programming language. The system will consist of 2 modules: - Client module - Server module Users should be able to send chat messages to each other in plain text using the client module. The server module will mediate the transmission and storage of messages. The server must be able to support multiple users to connect and send messages to each other at the same time. This assignment is similar to Question 4 in assignment 3, hence you can reuse the codes you have written previously; but with one important difference: If the receiver is online at the time of sending the message (connected to the server via socket and logged in), the server should immediately forward the message to the receiver without waiting. The client, on the other hand, should be able to instantly display the messages that spontaneously come from the server, on the screen. For outgoing and incoming messages, some additional information should also be displayed; i.e., for outgoing messages to whom it was destined to, and for incoming messages, the time of receiving the message and from whom it came should be displayed. For example, the screen flow after a user starts the client, connects to the server, and logs in might look like this: Session Started You have no waiting messages Message sent to ali: Hello Ali, how are you? 21:55:04-ali: thank you. If the recipient is offline, the server should store the message for later transmission. Storage of the messages need not be permanent; so you don't need to store messages in a permanent place like a disk or database. There is no harm in deleting messages when the server application is shutdown and started again. Therefore, you can store pending messages in a suitable data structure in memory. Initially the server must be up and running. Clients can connect, log-in and disconnect at different times. The clients will always send the messages and initiate the dialog, while the server

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning ASP.NET 2.0 And Databases

Authors: John Kauffman, Bradley Millington

1st Edition

0471781347, 978-0471781349

More Books

Students also viewed these Databases questions