Implement a logging server and client

Assignment Help Operating System
Reference no: EM131684823

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

Reference no: EM131684823

Questions Cloud

Define how you expect the environment to change : Develop a hypothesis regarding how you expect the environment to change within the jar over the course of the experiment
Discuss about the act in a new serial being produced : Can Ken argue that the ‘last on / first off' rule forms part of his contract and that he should therefore not be made redundant before Bob?
Define operational air emission rates : calculating maximum hourly and annual emission rates and emission rate averaged over a five-hour period
Summarize the published ecological impacts of atmospheric : Summarize the published ecological impacts of atmospheric deposition on affected ecological systems
Implement a logging server and client : In first task, you just need to implement a server that handles a single connection at a time. Your task in exercise is to implement a logging server and client
Define allocating water and economical considerations : Create an argumentative essay that describes your personal view on these issues, Explain why you would support or oppose
What facts can you select to show the lethality signs : Research lethality or danger assessments used by law enforcement agencies and victim advocacy centers. Describe what the assessments are used for.
Description of the soil type or specific problem : Find a rule/law/policy that addresses this problem. Using credible research, write a description of the soil type or specific problem
How each element of the marketing mix has been used : Establish the marketing mix component include information on how each element of the marketing mix has been used

Reviews

len1684823

10/20/2017 5:25:34 AM

Subject: Operating System. No Of Pages/Words: code. Message: linux c. The critical section in serverThreaded should be as short as possible. The server must not leak memory. Any code which does not compile on the virtual machine provided will be awarded 0 marks and not be reviewed.

len1684823

10/20/2017 5:25:24 AM

Submission consists of pushing your solution to your project as specified above; the last submission before the submission deadline has ended counts as your submission. It is worth trying out submission well before the deadline even if the solution is not correct yet. In Canvas we had to select "Submission on Paper", since the "Submission in external tool" option is broken. However, this is just a workaround: please do not submit any paper solutions.

Write a Review

Operating System Questions & Answers

  Implementation of algorithms for process management

The Shortest Job Next (SJN) algorithm queues processes in a way that the ones that use the shortest CPU cycle will be selected for running rst.

  Develop a user mode command interpreter

Develop a user mode command interpreter which support list-short.

  Memory allocation in operating system

Analysis and implementation of algorithms for memory allocation in operating system, Explain First- t and best- t methods are used in memory allocation in operating systems.

  Stand alone child process

Forking the child process

  Write a multi-threaded program

Write a multi-threaded program to solve producer and consumer problem

  Marginal and average cost curves

n a competitive market place (pure competition) is it possible to continually sell your product at a price above the average cost of production.

  Simulating operating systems scheduling

Simulate the long-term scheduler, the short-term scheduler and the I/O scheduler of the computer using the First-Come-First-Serve algorithm.

  Issues with trusted platform module

Research paper discussing the issues with Trusted Platform Module (TPM)

  Threads

Explain a complication that concurrent processing adds to an operating system.

  Design and programming

Use the semaphore methods to control the concurrency of the solution

  Virtual machines

Virtual machines supported by a host operating system

  Discuss an application that benefits barrier synchronization

Discuss an application that would benefit from the use of barrier synchronization

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