Creating a network messaging system

Assignment Help Computer Networking
Reference no: EM131468354

In this assignment, you will be creating a network messaging system that allows users to leave messages for other users. Your task is to use TCP sockets to create a server process that can store messages and allow them to be retrieved, and a client process that can be used to interact with the server. The protocol that your solution must implement is described below.

Protocol

Each command and response in the protocol consists of a string of ASCII characters followed by the line feed character (ASCII code 10). All commands and responses are case sensitive.

An interaction begins when a client sends a LOGIN <username> command to the server (where <username> is replaced with the name of the user to log in). Usernames must not include space (ASCII code 32) characters. If a LOGIN command is sent with the username containing a space, the server should see this message as an error.

The server responds to a LOGIN <username> command with the number of messages that are currently stored on the system for the user with the given username. Thus, if there are no messages for the user, the server will respond with θ.

After this response, the client can choose to either COMPOSE a message to be sent to a user, READ a message that was previously sent to the logged-in user, or EXIT the system.

To compose a message, the client sends a COMPOSE <username> command (where <username> is the name of the user they wish to send a message to), followed by a <message> command (where <message> is the single-line message to be sent), to the server. If the server successfully stores the message, the server must respond with MESSAGE SENT. Otherwise, the server must respond with MESSAGE FAILED. Your server must be able to store at least 100 unread messages for each user before failing (though it would be better if unlimited messages were supported).

To read a message, the client sends a READ command to the server. If there are no messages for the logged-in user, the server must respond with NO MESSAGES. Otherwise, the server must respond with <username>, followed by the response <message> (where <username> is the sender of the earliest unread message for the logged-in user and <message> is the content of that message). The message must then be removed from the server so that any further READ command would result in a different message being delivered to the user (or a NO MESSAGES response if there were no more messages).

To exit, the client sends an EXIT command and then disconnects from the server. When the server receives an EXIT command it must close the connection.

After a COMPOSE or READ interaction, the client can choose to either COMPOSE a message to be sent to a user, READ a message that was previously sent to the logged-in user, or EXIT the system.

Any other message sent to or from the client is considered an error, and should result in the receiving party dropping the connection.

Details -

1. startServer.sh which takes a port number as its only command-line parameter and attempts to start a server on that port. If the server is unable to be started (perhaps because that port is already in use), your program should exit with an appropriate error message.

2. startClient.sh which takes a host name as its first command-line parameter and a port number as its second command-line parameter and attempts to connect to the server with the given host name and port number. If the client is unable to connect, it should exit with an appropriate error message.

When your client first starts, it should ask for the user's username and automatically send a LOGIN message to the server. Your client should then guide the user through an interaction with the server until the user chooses to exit or the server responds with an invalid message (in which case you should indicate to the client that something has gone wrong with the server before exiting). It is important that your client ensures that only valid commands are sent to the server. If user input would result in an invalid command (e.g. the user includes a space character in their username), your client should notify the user of the problem and request new input.

Attachment:- Assignment File.rar

Reference no: EM131468354

Questions Cloud

Find the optimal protection level for high fare seats : Find the optimal protection level for high fare seats. If overbooking is allowed as in part (f), then what is the booking limit for the low fare seat?
What steps take to protect their company system from threats : Interview the IT staff of a company to find out whether they take information warfare or cyber terrorism into direct account when they are securing their system
What is the focus of the theory : What does the theory tell us about how things operate in the real world?What is the focus of the theory?
What is organizational effectiveness : What is organizational effectiveness? Discuss three approaches to evaluating effectiveness and the problems associated with each approach.
Creating a network messaging system : In this assignment, you will be creating a network messaging system that allows users to leave messages for other users
Identical outputs from two plants with cost function : A monopolist faces the demand function P = 100 - (q1 + q2) and produces identical outputs from two plants with cost function.
Start of the upcoming selling season for his bookstore : Dan McClure is trying to decide on how many copies of a book to purchase at the start of the upcoming selling season for his bookstore.
Women in the labour force : In the report "Women in the Labour Force" published in 2009 by the government of Saskatchewan.
Write the step you would take to secure system from threats : Pulling together what you have learned from previous chapters, what information can you apply to the protection of a system against cyber terrorism.

Reviews

Write a Review

Computer Networking Questions & Answers

  Homework 555 to guide you in your research you will be

to guide you in your research you will be answering various questions on can. you should answer each question fully.

  How will the network be effected

How will the network be effected - We wish to improve network reliability. How will inserting a node at a given point influence connectivity -

  Identify a company and choose one of its employees

Identify a company and choose one of its employees (for example, an information technology employee or a chief information officer [CIO]) who has been involved in a company-wide implementation of cloud computing.

  Brief summary of your learning team collaborative discussion

Create a 2-3 pages document based on your Week Two Learning Team collaborative discussion. A table listing the common link state and distance vector routing protocols; be sure to identify the following for each protocol:Link state or distance vector,..

  How each layer of the model represents communication flow

Describe how each layer of the Model/Suite represents the communication flow between organizational levels and across departments/division of an actual hierarchical business.

  Discuss the role of each of the server types on a lan

Discuss the role of each of the following server types on a LAN and the type of software licensing with which the software should be purchased:

  Design an ethernet network to connect a single client pc

Design an Ethernet network to connect a single client PC to a single server.  The two devices are 410 feet apart.  They need to communicate at 800 Mbps.

  Explain the impact of mobile devices on cybersecurity

The impact of the Internet on research methods of students and plagiarism in student papers. The impact of The No Child Left Behind (NCLB) Act on primary school education. The impact of mobile devices on cybersecurity.

  Implementing filter in the firewall

Consider yourself as the network security technician. Your internetwork connects six buildings through fiber links. You have experienced the numerous attacks on your corporate Web server.

  Sorne of me internets biggest companies le cones

sorne of me internets biggest companies le. cones hilcrosoffahnobdquo yak and vedsign are working on a new single

  Write short notes after investigating the scenario

Explain how does the CSMA/CA in DCF handle media contention and what would you recommend as a remedy to this drawback, if there any

  Disadvantages of several different web technologies

Describe the advantages and disadvantages of several different Web 2.0 technologies. How could these technologies be used for good? What types of problems might these technologies cause?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd