Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Network & Security Expert

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 command to the server (where 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 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 command (where is the name of the user they wish to send a message to), followed by a command (where 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 , followed by the response (where is the sender of the earliest unread message for the logged-in user and 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

Computer Network & Security, Computer Science

  • Category:- Computer Network & Security
  • Reference No.:- M92277093

Have any Question?


Related Questions in Computer Network & Security

Metasoft ltd is a software development company which works

MetaSoft Ltd is a software development company which works across Australia and New Zealand. The company is considering the following strategic proposal: - They plan to close down the Melbourne data centre rather than up ...

Per capita income of winterfell is 15000 with a growth rate

Per capita income of Winterfell is $15,000 with a growth rate of 4%. Per capita income of King's Landing is $25,000 with a growth rate of 0%. How long until per capita income is the same in both locations?

Question 1 for rsa encryption we need a modulus that is the

Question : 1. For RSA encryption we need a modulus that is the product of two prime numbers, p and q. Assume p = 11 and q = 13, and thus n = p*q = 143. In this case, the RSA encryption exponent e must be relatively prime ...

Question in regards to encryption does the public key and

Question : In regards to encryption, does the public key and private key come from the sender or does the receiver already have the private and is given the public key by the sender? The response must be typed, single sp ...

Security risk assessment executive summarya detailed

SECURITY RISK ASSESSMENT Executive Summary A detailed Information security risk assessment was carried out on Fiji Directories Limited (FDL) during October 15th 2018 to October 24th 2018. FDL, an ATH group company, is a ...

How would you explain the concept of a quality adjusted

How would you explain the concept of a quality adjusted life year? When is it appropriate to use "QALYs" instead of simply improved life expectancy as the outcome measure in an economic evaluation?

Data model development and implementationpurpose of the

Data model development and implementation Purpose of the assessment The purpose of this assignment is to develop data models and map Database System into a standard development environment to gain understanding of data m ...

Assignment descriptionproject scope a typical

Assignment Description Project Scope: A typical network layout diagram of a firm is given below for illustrative purposes only. The service requirements are enclosed. Figure. Network layout of a firm Service requirements ...

Prof gs farmer friend claims that aliens made crop circles

Prof G's farmer friend claims that aliens made crop circles in his farm. Using economic theory, prove his farmer friend wrong.

Assignment - network implementationbackgroundwidgets and

Assignment - Network Implementation Background Widgets and Gadgets (WaG) have recently acquired a business, We Make Stuff (WMS), in another city. Before work can commence on integrating WMS's network into WaG's, WMS actu ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As