Design and implement a program

Assignment Help Programming Languages
Reference no: EM131987374

Background:

This is where we separate our program into a client and a server. In Assignment 1 we focused on basic input / output with arrays. Assignment 2 will add network communications (sockets), more robust programming, processes / 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.

Objectives:

Design and Implement a program that does the following:

The Client:

• Loads and uses mychatclient.conf to set internal variables as mentioned below.
o If mychatclient.conf doesn't exist, your program should create it with an appropriate message and code.
o 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.
o The client should ask for connection information (e.g.: IP Address of sever) if not provided in the configuration file.
o 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, exit the program, etc)
o 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.
o Input should be buffer-overflow protected
o If the input does NOT begin with a / then your client should send this to the server.
o If the input DOES begin 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:
o Connection details
o Current user name
o Current server name
o Name of the current log file
o 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 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
o All message data from the server should be printed
o Status output should be printed with a different identifier. ie: # >

The Server:

• Loads and uses mychatserver.conf to set internal variables as mentioned below.
o If mychatserver.conf doesn't exist, your program should create it and log an appropriate message and code.
o 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.
o Create a LISTEN socket on 0.0.0.0 (all interfaces) OR on an interface defined in your configuration file
o If the input has a header type of 0x1 then you should send this to all connected clients.
o If the input has a header type of 0x2 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
o All chat output should be formatted to be preceded with the server and user name (ie: Server1 : Brett > )
o Status output should be printed with a different identifier. ie: # >
• Your server should have a logging facility. This should be a separate process.
o 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
o Logging will require inter-process communication.
• If the SIGQUIT (3) or SIGTERM (15) signals are received, your program should:
o Signal any children still active to terminate
-  If the children do not respond in a timely manner, your program should KILL (9) them
o Log an appropriate message to the log file
o Close all open files
• If the SIGHUP (1) signal is received (you will have to trap this signal) then
o Record the request in the log file
o open your programs configuration file
o read in the configuration file
o reset your programs parameters based on the configuration you read in
o open your log file
o record the final status of the SIGHUP process
o All current socket connections will need to be migrated over to any new network settings

Cryptography:

All network transmissions should be encrypted. This means once you are ready to transmit application data, you will need to call an encryption function before sending it to the other end. This also means that when you receive data, you will need to decrypt the data once you receive it. You will also need to be able to verify that decrypted data has been properly decrypted before use.

For those doing the unit CSI2108 Cryptographic Concepts and wishing to combine your assessment into one work, you will be required to write your own crypto library which will be assessed in that unit.

For those not doing CSI2108 or not wishing to combine your assessments into one working whole, I will be providing you with a binary library and header file so you can link this into your application. It will be a binary library so you will not be able to see the any code, the most you will be able to see is the function headers in the provided header file.

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.
This should at minimum have Username, Logfile name, , Default IP Address for the server to use if unspecified.

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. This should at minimum have Servername, Logfile name, Default server IP Address to connect to.

Reference no: EM131987374

Questions Cloud

Describe the ways to prevent health-related injuries : Describe the ways to prevent health-related injuries and disorders caused from technology use.
Summarise the main arguments for and against globalisation : Summarise the main arguments for and against globalisation, as outlined in the video/documentary by Hernando De Soto.
Accurate for the attribute important to a database : Why are data types that are accurate for the attribute important to a database? What happens if incorrect data types are used?
How many orders will it place per year : Fixed costs per order are $156 and carrying cost is $29 per unit per year. If management uses an EOQ model, how many orders will it place per year?
Design and implement a program : CSP2308 Programming Principles - Design means Pseudocode, Flowcharts, Functional Decomposition, etc. network communications (sockets), more robust programming
Explain the characteristics and uses of smartphones : Explain the characteristics and uses of smartphones, digital cameras, portable media players, and e-book readers.
Implementation of a bsc in small-medium-sized organization : If a manager in charge of the implementation of a BSC in a small or medium-sized organization, what steps this manager would take to ensure its success?
Discuss history of health program planning and evaluation : Discuss the history of health program planning and evaluation. What one event stands out as a significant catalyst in this process and why?
Organizational culture and international expansion : How does the national culture of an organization affect the way the organizational culture is transported to another country

Reviews

len1987374

5/18/2018 3:28:46 AM

Marking Guide Design 10 Implementation Use of make and multiple files 2 Use of configuration files 2 Correct and appropriate use of sockets 5 File Functions (file exists/readable, open, read, etc) 5 Data Protocol implemented correctly 2 Signals implemented and handled appropriately 2 Crypto is present and functional 2 Implementation Sub-total 20 Program compiles and runs 10 Extra cool features (additional features)! (Extra Marks) 10 Total (cannot exceed) 40

Write a Review

Programming Languages Questions & Answers

  Write a haskell program to calculates a balanced partition

Write a program in Haskell which calculates a balanced partition of N items where each item has a value between 0 and K such that the difference b/w the sum of the values of first partition,

  Create an application to run in the amazon ec2 service

In this project you will create an application to run in the Amazon EC2 service and you will also create a client that can run on local machine and access your application.

  Explain the process to develop a web page locally

Explain the process to develop a Web page locally

  Write functions

These 14 questions covers java class, Array, link list , generic class.

  Programming assignment

If the user wants to read the input from a file, then the output will also go into a different file . If the user wants to read the input interactively, then the output will go to the screen .

  Write a prolog program using swi proglog

Write a Prolog program using swi proglog

  Create a custom application using eclipse

Create a custom Application Using Eclipse Android Development

  Create a application using the mvc architecture

create a application using the MVC architecture. No scripting elements are allowed in JSP pages.

  Develops bespoke solutions for the rubber industry

Develops bespoke solutions for the rubber industry

  Design a program that models the worms behavior

Design a program that models the worm's behavior.

  Writing a class

Build a class for a type called Fraction

  Design a program that assigns seats on an airplane

Write a program that allows an instructor to keep a grade book and also design and implement a program that assigns seats on an airplane.

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