Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask C/C++ Expert


Home >> C/C++

Assignment Phase

Background

This assignment aims to assess your C programming skills and forms the second phase of the development of a UNIX peer-to-peer file transfer application. The second phase of the assignment will build on from phase 1 to add network communications through sockets and the ability to handle multiple peers connecting simultaneously and will require asynchronous programming techniques.

You will be expected to submit not only the source code to your program but also a complete design for your program. The design can use pseudocode, flowcharts, functional decomposition, or another form of design and will be assessed on usefulness, correctness and coverage.

Objectives

Design and develop a program that does the following:

Loads and uses a configuration file, called settings.conf;

-set (at minimum) the following internal variables

  • Username
  • Port
  • IP address
  • Logfile filename

-If the configuration file doesn't exist, your program should create one with default values and log the event.

-If the configuration file is not readable, your program should continue with default settings and log an appropriate message.

-Any line beginning with a '#' character should be ignored as a comment.

Loads and uses a "sharing list" file that contains a list of records containing the following data:

  • Filename of the file to be shared
  • Full path of the file to be shared
  • Sharing permissions for the file (Either shared with all or shared with individual users)
  • If the sharing list file itself does not exist, it should be created.
  • When the program starts it should check that each listed file exists and is readable. If it does not exist or is not readable, the file should be removed from the sharing list file.

Maintains a sharing list and allows the user to add or remove files (with appropriate sharing permissions) to/from the sharing list

  • Add/remove individual file
  • Add/remove all files within a directory

Loads and uses a "friends list" file that contains a list of known peer records containing the following data:

  • IP address/hostname
  • Port
  • Username
  • If the friends list file itself does not exist, it should be created

Maintains a friends list and allows the user to add or remove friends to/from the friends list

Allows the user to connect to a peer in the friends list and receive a listing of files shared by that peer (those that the user has permission to access)

Allows the user to request a file to be downloaded from that peer.

  • Downloaded files should be saved in a "downloads" folder.

Allows multiple peers to connect and download files simultaneously from a single peer

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

  • Signal any children still active to terminate (if appropriate): 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

Contains a logging facility that logs at leastthe following information to a file:

  • Program started (on IP:port)
  • Program exited
  • Sharing list created
  • Friend list created
  • File added to sharing list
  • File removed from sharing list
  • Friend added to friends list
  • Friend removed from friends list
  • Peer connected
  • Peer disconnected
  • File upload
  • File download

The logger should run asa separate process and allow asynchronous requests to log information.

GNU Make should be used to build the application from source and your makefile should contain at least "make" and "make clean" build targets.

Functions should be loosely coupled and highly cohesive wherever possible.Your program source should be well structured and make use of multiple .c files and appropriate header files with clear separation of concerns.

Your submission should include, at minimum, the following files:

files.cand files.h

This should contain your main() program and code associated with your programs main logic such as reading and loading your configuration, maintaining file lists, taking input for instructions.

io.cand io.h

This should contain your code to do with input and output in general. This will be mainly File and screen i/o for phase one.

logger.cand logger.h

This should contain all your code associated with logging.

networking.cand networking.h

This should contain all your code associated with establishing connections to peers or sending data over a network.

settings.conf

makefile

So you think you're done:

Does your program compile and run?

Is your program in multiple files and is then linked together? Using #include to copy .c files into your main program file is NOT appropriate!

Does your program load and use a friends list save file?

Can you edit the friends list? (Add/remove/view file and user entries)

Does your program deal with bad input?

Can a peer select a file from your sharing list and download it?

Can multiple instances of your program download files from you simultaneously?

Can you select a file from a peer's sharing list and download it?

Do you use fgets(), fputs() and/or fprintf() and avoid scanf() and printf()?

Does your program create a logfile if one doesn't exist?

Does your logger actually record the required events in the logfile?

Does your logger run in a separate process?

Do you handle the SIGQUIT, SIGTERM and SIGHUP signals?

Does each of your functions do only one thing?

Need it as per the guidelines.

Attachment:- Assignment File.rar

C/C++, Programming

  • Category:- C/C++
  • Reference No.:- M92299744

Have any Question?


Related Questions in C/C++

There are several ways to calculate the pulse width of a

There are several ways to calculate the pulse width of a digital input signal. One method is to directly read the input pin and another method (more efficient) is to use a timer and pin change interrupt. Function startTi ...

Why do researcher drop the ewaste and where does it end

Why do researcher drop the ewaste and where does it end up?

Assignment word matchingwhats a six-letter word that has an

Assignment: Word Matching What's a six-letter word that has an e as its first, third, and fifth letter? Can you find an anagram of pine grave. Or how about a word that starts and ends with ant (other than ant itself, of ...

Question 1find the minimum and maximum of a list of numbers

Question: 1. Find the Minimum and Maximum of a List of Numbers: 10 points File: find_min_max.cpp Write a program that reads some number of integers from the user and finds the minimum and maximum numbers in this list. Th ...

Software development fundamentals assignment 1 -details amp

Software Development Fundamentals Assignment 1 - Details & Problems - In this assignment, you are required to answer the short questions, identify error in the code, give output of the code and develop three C# Console P ...

What are the legal requirements with which websites must

What are the legal requirements with which websites must comply in order to meet the needs of persons with disabilities? Why is maximizing accessibility important to everyone?

Assign ment - genetic algorithmin this assignment you will

ASSIGN MENT - GENETIC ALGORITHM In this assignment, you will use your C programming skills to build a simple Genetic Algorithm. DESCRIPTION OF THE PROGRAM - CORE REQUIREMENTS - REQ1: Command-line arguments The user of yo ...

1 implement the binary search tree bst in c using the node

1. Implement the Binary Search Tree (BST) in C++, using the Node class template provided below. Please read the provided helper methods in class BST, especially for deleteValue(), make sure you get a fully understanding ...

Project - space race part a console Project - Space Race Part A: Console Implementation

Project - Space Race Part A: Console Implementation INTRODUCTION This assignment aims to give you a real problem-solving experience, similar to what you might encounter in the workplace. You have been hired to complete a ...

  • 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