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

  Networking and types of networking

This assignment explains the networking features, different kinds of networks and also how they are arranged.

  National and Global economic environment and ICICI Bank

While working in an economy, it has a separate identity but cannot operate insolently.

  Ssh or openssh server services

Write about SSH or OpenSSH server services discussion questions

  Network simulation

Network simulation on Hierarchical Network Rerouting against wormhole attacks

  Small internet works

Prepare a network simulation

  Solidify the concepts of client/server computing

One-way to solidify the concepts of client/server computing and interprocess communication is to develop the requirements for a computer game which plays "Rock, Paper, Scissors" using these techniques.

  Identify the various costs associated with the deployment

Identify the various costs associated with the deployment, operation and maintenance of a mobile-access system. Identify the benefits to the various categories of user, arising from the addition of a mobile-access facility.

  Describe how the modern view of customer service

Describe how the greater reach of telecommunication networks today affects the security of resources which an organisation provides for its employees and customers.

  Technology in improving the relationship building process

Discuss the role of Technology in improving the relationship building process Do you think that the setting of a PR department may be helpful for the ISP provider? Why?

  Remote access networks and vpns

safekeeping posture of enterprise (venture) wired and wireless LANs (WLANs), steps listed in OWASP, Securing User Services, IPV4 ip address, IPV6 address format, V4 address, VPN, Deploying Voice over IP, Remote Management of Applications and Ser..

  Dns

problems of IPV, DNS server software, TCP SYN attack, Ping of Death, Land attack, Teardrop attack, Smurf attack, Fraggle attack

  Outline the difference between an intranet and an extranet

Outline the difference between an intranet and an extranet A programmer is trying to produce an applet with the display shown in Figure 1 below such that whenever one of the checkboxes is selected the label changes to indicate correctly what has..

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