Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask C/C++ Expert


Home >> C/C++

Implement a "message server" in a distributed environment (i.e. between processes running on machines that are physically separate) by using BSD sockets.

In this assignment, we will provide a writer program (i.e. you will be given a writer program), and you are required to create a server program, which will communicate with writers by sockets. 3 identical writer programs (except for names, writer 1, writer 2, and writer 3, respectively) will run on one or more machines and the server on another machine.

Assignment Specifications:

1. Each writer program will connect and send a message (i.e. message "writer1" will be sent to the server from writer 1) to the server.

2. The server process will accept this socket connection from a writer, and create a thread process after the socket is accepted.

3. After a thread is created it is responsible for taking care of communication (Step 4) with the writer, and the parent process loops back to listen for a connection - this makes the parent ready for another connection.

4. A message from the writer must be stored by the appropriate thread processes in shared memory. This memory is shared by the server and all its threads, and can store only one message. The message length will be no more than 15 characters (14 chars plus 1 char string terminator in C), such as "writer1" "writer2" and "writer3".

5. A writer process should be invoked (started) with the writer name. For instance, suppose writer program name is "writerp", the first writer should be started by typing " writerp" and will real the message from the file infile.

6. The shared memory must be properly protected as a critical section so that the stored message will never be corrupted even during the handling of concurrent connections from multiple writers.

7. After a message from a writer is successfully stored in the shared memory by one of the server threads, after a 2 second sleep, the actual contents of the shared memory should be sent back to the original writer by the same server thread.

8. Set the server up to run on netcluster.cse.usf.edu (131.247.3.8 is the IP address). Use port 1050 as the port for listening. You will need to examine the socket, connect, bind, listen, accept, send and rccv man pages for the appropriate system calls. (some of them, such as send, gotten via man send). Your server should loop for a total of n connection accepts, where n will be 3 in our trials.

Look at setsockopt to free the socket after use.

Attachment:- Assignment Files.rar

C/C++, Programming

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

Have any Question?


Related Questions in C/C++

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 ...

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 ...

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 ...

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 ...

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?

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 ...

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?

  • 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