Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Network & Security Expert

Background:

This is where we separate our program into a client and a server. In Assignment 1 we focused on basic input/output with streams. Assignment 2 will add network communications (sockets), more robust programming, threads and adding the ability to handle multiple remote clients.

This version of the chat server will run a client and as server. The client will locally, receive requests from the keyboard (console) and either fulfil them locally or, if appropriate, send them to the server. The server will receive data and either act on it or relay this information to all connected clients.

NOTE: Design means Pseudocode, Flowcharts, Functional Decomposition, etc. This is NOT how prettily your code is structured or laid out!

Objectives: Design and Write a program that does the following:

The Client:

-Loads and uses mychatclient.conf to set internal variables as mentioned below.

If mychatclient.conf doesn't exist, your program should create it with an appropriate message and code.

If mychatclient.conf isn't readable, your program should terminate gracefully with an appropriate message and code. This is different from the file not existing.

-Once the configuration is loaded, the client should connect to the server.

The client should ask for connection information (e.g.: IP Address of sever) if not provided in the configuration file.

If the client cannot connect to the server, your program should handle this neatly and allow for some recourse. (ie: retry, change connection details and try again, etc)

Once connected, the client should send all relevant connection information that the server requires (ie: username, etc) and should receive all relevant information (ie: servername, etc).

-Takes input from the keyboard.

Input should be buffer-overflow protected

If the input not preceded with a / then your client should send this to the server.

If the input IS preceded with a / then your client should interpret this as a command

  • If the command is intended for the client, the client should act on it. The MINIMUM commands should be:
  • /name should allow the user to change the displayed username
  • /reload should reload the configuration file and reset your program parameters based on what it reads from the configuration file.
  • /status should show current details including but not limited to:

                Connection details

                Current user name

                Current server name

                Name of the current log file

                Any other details you think are useful

  • /quit should allow the user to quit. This will require sending a /quit command to the server, having the server close the connection and then allow the client to shutdown gracefully.
  • If the command is intended for the server, the client should send it to the server intact.
  • /name should allow the user to update the username on the server (There is a client and server portion to this command.)
  • /quit should allow the user to quit. This will require sending a /quit command to the server, having the server close the connection
  • /servername should allow the user to change the server name

-Receives network data and outputs to the screen

All message data from the server should be printed

Status output should be printed with a different identifier. ie: # >

The Server:

-Loads and uses mychatserver.conf to set internal variables as mentioned below.

If mychatserver.conf doesn't exist, your program should create it and log an appropriate message and code.

If mychatserver.conf isn't readable, your program should terminate gracefully while printing AND logging an appropriate message and code. This is different from the file not existing.

-Once the configuration is loaded, the server should begin listening for connections on the defined port (configuration file).

-Accepts network connections and input from clients.

Create a LISTEN socket on 0.0.0.0 (all interfaces) OR on an interface defined in your configuration file

If the input not preceded with a / then you should send this to all connected clients.

If the input IS preceded with a / then you should interpret this as a command. The MINIMUM commands should be:

/name should allow the user to update the displayed username

/servername should allow the user to change the server name

/quit should allow the user to close the connection.

-Sends output to the clients

All chat output should be formatted to be preceded with the server and user name (ie: Server1 : Brett >)

Status output should be printed with a different identifier. ie: # >

-Your server should have a logging facility. This should be a separate process.

You should check to see if the log file exists.

If it does, open it and begin logging important messages

If it does not, create it and begin logging important messages

Logging will require inter-process communication.

-If the SIGQUIT (3) or SIGTERM (15) signals are received, your program should:

Signal any children still active to terminate

  • If the children do not respond in a timely manner, your program should KILL (9) them

Log an appropriate message to the log file

Close all open files

-If the SIGHUP (1) signal is received (you will have to trap this signal) then

Record the request in the log file

open your programs configuration file

read in the configuration file

reset your programs parameters based on the configuration you read in

open your log file

record the final status of the SIGHUP process

All current socket connections will need to be migrated over to any new network settings.

Using make to manage (at minimum) these files:

Client:

mychatclient.c

This should contain the main logic of your code

myinput.c

This file could handle all input including safely checking if the input is valid, checks against exploits such as buffer overflows.

myoutput.c

This file could handle all output including all formatting and other output related processing.

mychatclient.conf

This file should be a configuration file that you can use to set the behaviour of your main program.

Server:

mychatserver.c

This should contain the main logic of your code

mylogger.c

This file should contain any functions that handle logging operations

network.c

This file could handle all network code.

myoutput.c

This file could handle all output including all formatting and other output related processing.

mychatserver.conf

This file should be a configuration file that you can use to set the behaviour of your main program.

Feel free to use other files to break up the structure of your program.

Attachment:- Assignment.rar

Computer Network & Security, Computer Science

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

Have any Question?


Related Questions in Computer Network & Security

Overviewthis assignment has three major aims- to help

Overview This assignment has three major aims: - To help students gain good understanding of theoretical and practical material. - To encourage students to use content analysis summaries to prepare for tests, examination ...

Describe 2 variables a government will look at to predict

Describe 2 variables a government will look at to predict where the economy will be in the next six months.

Content analysis assignmentoverviewthis assignment has

Content Analysis Assignment Overview This assignment has three major aims: - To help students gain good understanding of theoretical and practical material. - To encourage students to use content analysis summaries to pr ...

Wireless sensor networks wsn let users to access servers

Wireless Sensor Networks (WSN) let users to access servers, printers, and other network resources regardless of their location, within the wireless reach. This flexibility means that, for example, a user's laptop stays c ...

Sip encodingwhy does the session initiation protocol sip

SIP, ENCODING Why does the session initiation protocol SIP allow the sender and receiver to choose two different multimedia encoding schemes? Describe a scenario where it makes sense to use different protocols for sender ...

Nbspfor the remaining questions consider a 4-bit block

For the remaining questions, consider a 4-bit block cipher, described in hexadecimal by the following table: Plaintext Ciphertext Plaintext Ciphertext 0 a 8 e 1 c 9 d 2 f a 0 3 6 b 7 4 3 c 5 5 8 d b 6 4 e 9 7 2 f 1 You c ...

Question do some research and find a case of cyber

Question : Do some research and find a case of cyber harassment or cyberbullying. Explain the case, and discuss the relevant theories of criminal justice associated with the perpetrator(s). Your response should be a mini ...

What is the difference between a positive economic

What is the difference between a positive economic statement and a normative one.

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 ...

About rsa please answer the following questionsa suppose

About RSA, please answer the following questions. (a) Suppose p=11 and q=7. What is ? (n), where n=p?q? (b) If the public key e is 11, find the private key d. (c) If the ciphertext is 4, what is the plaintext? (d) For en ...

  • 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