Question
Objective: The purpose of this assignment is to provide some exposure to the issues involved in designing a distributed system. In this particular case, to
Objective:
The purpose of this assignment is to provide some exposure to the issues involved in designing a distributed system. In this particular case, to the implementation of a service broker application.
Each team will need to develop five small programs as described below:
Program 1: This program will be the service broker application using a well known port (a port that both client applications as well as service providers know to request services from the broker. The broker will interact with both service providers as well as clients.
As far as requests from service providers, the broker should be able to receive registration and unregistration requests. The registration requests from service providers, should be handled by entering (and maintaining) a table of IP address/port #/Service name (e.g., echo, time, etc.) for each registered service provider (server). The unregistration requests from service providers which are shuting down and will not be able to provide service to clients anymore should be handled by removing the server from the table. It is up to each team to decide if you want to use UDP or TCP to provide the brokerage service.
As far as requests from clients, the broker should be able to receive query request from clients wanting to know where a particular server is located. The broker should look up the service that the client is inquiring about (e.g., time, echo, etc.) and return the information of a server providing that service which has previously registered itself with the broker, i.e., IP address and port number being used by the server to provide the given service.
The broker program should print out enough information to the screen verify that it is working correctly. i.e., after every request, it should print IP Address and Port Number of sender, the request type, the reply sent and the current state of the table after the request was processed.
Program 2 Server A: Case Normalizer Server. This server should register with the broker upon start and then proceed to accept requests from clients and service them. You will also need to have a graceful way for the server to shut down after unregistering with the broker. This server could be iterative or concurrent (preferably concurrent so you can service multiple clients at the same time). This server will receive from clients requests to change a line of text and either make it ALL upper case or all lower case depending on what the client wants.
For instance:
Request:
U-This is the line of text
Reply:
THIS IS THE LINE OF TEXT
Request:
L-Introducing the Best Professor at UHCL: Name of Your Favorite Professor Here
Reply
introducing the best professor at uhcl: name of your favorite professor here
Program 3 Server B: ENCRYPT/DECRYPT server. Your server should also register its IP address and port number with the broker service and then proceed to accept requests from clients and service them. You will also need to have a graceful way for the server to shut down after unregistering with the broker. This server application should be a multithreaded or multiprocess application that receives connection requests (TCP) from client(s) and hands each client off to a new thread or process to be serviced. The original thread/process should go back to accept connections from other clients. The new thread/process should interact with the client until the client decides to terminate the connection. Each request from the client should be a) A request to encrypt a line of text b) a request to decrypt a previously encrypted line of text or c) a terminate command that indicates the client is about to close the connection and wont be sending any more requests.
For a) the server should encrypt the line of text using whichever encryption algorithm you choose, it could be as simple as you want to make it, as long as the returned line looks like garbage to the naked eye.
For b) the server should decrypt the line of text by running the reverse algorithm and return the original line that was previously encrypted.
For c) the thread/process must close the connection and exit.
Program 4 Server C: Time Server, Your server should also register its IP address and port number with the broker service and then proceed to accept requests from clients and service them. You will also need to have a graceful way for the server to shut down after unregistering with the broker. The server should implement a simple time protocol, accept a connection request from a client, return the current time and close the connection. This can be an iterative server since the service is so simple.
Any of the servers could be terminated and started in another machine, new clients should be able to find the new server transparently.
Program 5 - Client: The client should:
Interact with the user (you) and asks what the user wants to do? a) interact with the Case Normalizer Server b) interact with the encryption/decryption server or c) interact with the time server or d) quit. Before it interacts with the requested server, the client should inquire from the service broker what is the IP address and port number where the corresponding server can be found.
For a) the client should ask the user for a line of text and whether it should be turned to Upper Case or Lower Case, send the request to the appropriate server, receive the reply and display it on the screen. Then go back to ask again what the user wants to do.
For b) the client should contact the service broker to find a location of an ENCRYPT/DECRYPT server, then ask the user if he/she wants to encrypt, decrypt or stop, then ask for a line of text to be encrypted or decrypted depending on the previous answer and send the appropriate request to the server, receive the replay and display it in the screen. Repeat until the user chooses to stop, in which case it should close the connection with the server and go back to ask the user which server to interact with or quit. i.e. a client should be able to send multiple lines to the server to be encrypted/decrypted until the user decides to stop.
For c) the client should ask the broker for the location of a time server, contact the time server and get the time, then display it in the screen.
Client should be in a loop asking the user a choice a), b), c) or d) until the user chooses d) and decides to quit.
PART A:
Turn in a word/spreadsheet document describing the protocols you will be implementing between your applications:
- Protocol between Service Broker and Service Provider
- Protocol between Service Requester and Service Broker
- Protocols between Service Requester and Service Provider(s)
Each protocols should include if it will be connection oriented or connectionless (TCP or UDP) and a description of each message sent between the applications including requests and replies:
Message Type, Action requested (if necessary), Data encoding if necessary (integers, strings, objects, etc.), what will the receiver do to satisfy the request, anything else you think you might need.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started