Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Operating System Expert

Question - Your task in exercise is to implement a logging server and client.

The client is a program that takes 2 arguments:

* A hostname of a logging server, for example log.cs.bham.ac.uk

* A port number of the logging server, for example 5555

After it started, it will connect to the server and read messages from STDIN. Every message is a string without 0 bytes. Messages are terminated by a newline character \n. When there is nothing to read anymore or SIGINT, or SIGTERM is received, it will close the connection and terminate with return code 0.

When there is an internal problem, such as the connection to the server breaks, an input cannot be parsed or a similar problem, the return code should be 1. Also you should print an error message that describes the internal error to STDERR.

The server is a program that takes 2 arguments:

* The port number to bind to, for example 5555

* A filename of a file to write the logs to, for example: /var/log/messages.log

After the server is started, it will bind to the port and listen for incoming connections. For every connection, the server will read messages and write them to the logfile. The format of the logfile is always a line number in decimal followed by a space followed by the message itself with a \n newline character at the end. When SIGINT or SIGTERM is received, the server will terminate. When it cannot bind to the port, it will return with return code 1. When a certain file cannot be opened or writing to a file fails, you should write an error message to STDERR but continue to operate.

The server should be able to handle inputs that are not properly formatted and should never crash. The client should also be able to handle any kind of unexpected responses from the server or invalid lines in the input or command line argument.

# Language and project format

You should implement your project in C and compile it with gcc from the course VM. You are required to use '-D_POSIX_SOURCE -Wall -Werror -pedantic -std=c99 -D_GNU_SOURCE -pthread' as command line arguments. You will write a Makefile that will compile the project to three binaries, namely "serverSingle", "serverThreaded" and "client" as the default target. Do not use any files or directory with the prefix "test", since we will use such files for running tests. Your solution must be contained in a folder exercise2 in your project on the School's git server. The folder exercise2 must be at the top level your project for the marking scripts to work.

We will run the command make in the folder exercise2 in order to obtain all required binaries.

# Parallelism

This tasks consists of two sub-tasks.

In the first task, you just need to implement a server that handles a single connection at a time. For a perfect implementation, you will receive at most 10 points. Your result must compile to serverSingle.

In the second task, you will implement a multi-threaded server that handles in general an arbitrary number connections in parallel, as long as system resources are available. For a perfect implementation, you will receive at most 10 points. Your result must compile to serverThreaded.

Of course, every correct solution of serverThreaded is also a correct solution for serverSingle. So when you are confident, feel free to start with serverThreaded directly and just copy the result to serverSingle.

Attachment:- Assignment Files.rar

Operating System, Computer Science

  • Category:- Operating System
  • Reference No.:- M92493522
  • Price:- $60

Guranteed 36 Hours Delivery, In Price:- $60

Have any Question?


Related Questions in Operating System

Research types of operating systems that are currently

Research types of operating systems that are currently available and provide a scenario in which the operating system you chose would be appropriate to be used in this situation. Explain why you think the choice you made ...

Question description of lasa in this assignment you will

Question: Description of LASA: In this assignment, you will select a real-world operating system (can be for a PC, server, tablet, handheld, or embedded device). You will introduce the operating system and its components ...

Question what do you see as the major differences between

Question : What do you see as the major differences between UNIX/Linux and other operating systems, such as Windows and Mac OS X? The response must be typed, single spaced, must be in times new roman font (size 12) and m ...

Question you are a security administrator responsible for

Question: You are a security administrator responsible for providing secure configuration requirements for new laptop deployments. After reading Module 2 of Certified Secure Computer User v2exercises, apply the configura ...

Question research hex editors available for mac os and

Question : Research hex editors available for Mac OS and Linux. Based on the documentation, how easy would validating these tools be? Select at least two hex editors for each OS, and discuss what you would do to validate ...

State the required answer precisely and then provide proper

State the required answer precisely and then provide proper explanation. It is not enough to provide one- word or one-line answers. Consider a computer embedded in the control of a manned spacecraft. Would it require an ...

Show all stepssuppose that the following processes arrive

Show all steps Suppose that the following processes arrive for execution at the times indicated. Each process will run the listed amount of time. in answering the questions, use non-preemptive scheduling and base all dec ...

Question 1answer the following questions 10 marks a

Question 1 Answer the following questions: 10 marks a. Consider the following page reference string: 3, 1, 4, 1, 2, 3, 5, 3, 2, 1, 2,5, 4, 3, 5, 2, 4,2, 5,3 Using the above page reference string display the contents of t ...

Question state the required answer precisely and then

Question : State the required answer precisely and then provide proper explanation. It is not enough to provide one- word or one-line answers. What is the purpose of the command interpreter? Why is it usually separate fr ...

Question topic computerized operating systems os are almost

Question: Topic: Computerized Operating Systems (OS) are almost everywhere. We encounter them when we use out laptop or desktop computer. We use them when we use our phone or tablet. Find articles that describes the diff ...

  • 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