Project On Implementing A Message Server | Server Program

Added on - 22 Sep 2019

  • 3

    Pages

  • 1047

    Words

  • 184

    Views

  • 0

    Downloads

Trusted by +2 million users,
1000+ happy students everyday
Showing pages 1 to 1 of 3 pages
In this project, we will implement a “message server” in a distributedenvironment (i.e. between processes running on machines that arephysically separate) by using BSD sockets.In this assignment, we will provide a writer program (i.e. you will be given awriter program), and you are required to create a server program, which willcommunicate with writers by sockets. 3 identical writer programs (except fornames, writer 1, writer 2, and writer 3, respectively) will run on one or moremachines and the server on another machine (netcluster.cse.usf.edu).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 — you do not have todo this) 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 ofcommunication (Step 4) with the writer, and the parent process loopsback to listen for a connection — this makes the parent ready foranother connection.4.A message from the writer must be stored by the appropriate threadprocesses in shared memory. This memory is shared by the server andall its threads, and can store only one message. The message lengthwill be no more than 15 characters (14 chars plus 1 char stringterminator in C), such as ”writer1” ”writer2” and ”writer3”.5.A writer process should be invoked (started) with the writer name. Forinstance, suppose writer program name is ”writerp”, the first writershould be started by typing ”writerp” and will read the message fromthe file infile.6.The shared memory must be properly protected as a critical section sothat the stored message will never be corrupted even during thehandling of concurrent connections from multiple writers.7.After a message from a writer is successfully stored in the sharedmemory by one of the server threads, after a 2 second sleep, theactual contents of the shared memory should be sent back to theoriginal writer by the same server thread.8.Set the server up to run on netcluster.cse.usf.edu (131.247.3.8 is the IPaddress). Use port 1050 as the port for listening. You will need to
desklib-logo
You’re reading a preview
Preview Documents

To View Complete Document

Click the button to download
Subscribe to our plans

Download This Document