How prettily your code is structured or laid out

Assignment Help Computer Networking
Reference no: EM131067384

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

Reference no: EM131067384

Questions Cloud

Describe how the website relates and supports : Write a 250-word summary describing how the website relates and supports - Internet for pertinent information that supports the four pillars of safety management.
Ground state energy of the electron : An electron is in an infinite square well that is 8.9-nm wide. The ground state energy of the electron is closest to:
What length of belt is required to join them as shown : Drive Wheels of an Engine TIle drive wheel of an engine is 13 inches in diameter, and the pulley on the rotary pump is 5 inches in diameter. If the shafts of the drive wheel and the pulley are 2 feet apart, what length of belt is required to join ..
What is the likelihood of the bill becoming law : Find a current bill that has been filed with your local state legislative body or the federal legislative body that would impact emergency management. International students can select any U.S. state. How does the bill benefit the emergency manage..
How prettily your code is structured or laid out : 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: Loads and uses mychatclient.conf to set internal ..
Comparative balance sheets and income statement : The following comparative balance sheets and income statement are available for ABC Inc. Prepare a statement of cash flows for 2016 using the indirect method and analyze the statement.
Acceleration of the aircraft when it launches : The catapult on an aircraft carrier can take an aircraft weighing 300,000 N from 0 to 88.7 m/s in 9.9 seconds, at which time the aircraft launches. What is the acceleration of the aircraft when it launches?
Crystallographic generator matrix : What is a crystallographic generator matrix? How does this relate to symmetry matrices?
Length of the pole shadow on the bottom of pond : What is the length of the pole's shadow on the bottom of the pond?

Reviews

Write a Review

Computer Networking Questions & Answers

  Evaluating principal physical characteristics for biometric

The security manager is to estimate principal physical characteristics used for biometric user authentication,  concepts of enrollment.

  Describe the effects of spyware and adware

Describe the effects of spyware and adware. How has spyware and adware influenced public's confidence in security of the Internet?

  An application-level and a circuit-level one

What is a gateway, and what is the difference between an application-level and a circuit-level one?

  Technical recommendation for addressing the security

Describe your technical recommendation for addressing the security requirements in the overall technical design of the ABC Healthcare network. This should include both internal and external (untrusted and trusted) aspects. Untrusted would include ..

  Prepare a budget for the complete project

A well researched and comprehensive definition of Network Infrastructure Management is given. The general responsibilities of the network manager are listed.

  Design a new network for western trucking

Western Trucking operates a large fleet of trucks that deliver shipments for commercial shippers such as food stores, retailers, and wholesalers. Design a new network for them, including the specific backbone and LAN technologies to be used

  Explain how does a vlan and firewall combination help you

you are the senior network architect for a large corporation. the company has offices in l.a. new york and miami. the

  Implement a crude version of remote procedure call

You are required to implement a crude version of Remote Procedure Call. Normally this would require some degree of compiler support. However, we will simplify the interface so that the basic RPC is there, and it is only a matter of syntactic sugar..

  Create an in-house private social network and then use it

1 are companies that introduce a significant change in their industries thus causing a disruption in normal business

  Current network diagram infrastructure

Determine which devices you will use for both the current network diagram infrastructure consisting of firewalls, routers, and workstations as well as the device you need to incorporate. Include the following for each:

  Discuss the various different vpn solutions

Security is a major concern among all vendors in and out of the networking world. Despite this being a global issue, the network is still to blame. Discuss the various different VPN solutions and the protocols they use to secure data end-to-end

  Assume that you are an administrator for a growing company

imagine you are an administrator for a growing company. your company decides to purchase another company that designs

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