Has to work on the given ubuntu virtual machine. Must give the ON SCREEN MESSAGES as per the document. Need it urgently. Sample input files given in a.txt and b.txt


Has to work on the given ubuntu virtual machine. Must give the ON SCREEN MESSAGES as per the document. Need it urgently. Sample input files given in a.txt and b.txt


EE450_Project_Doc_Spring_2023 EE450 Socket Programming Project, Spring 2023 Due Date : Sunday, Apr 23, 11:59PM (Midnight) (The deadline is the same for all on-campus and DEN off-campus students) Hard Deadline (Strictly enforced) The objective of this assignment is to familiarize you with UNIX socket programming. It is an individual assignment and no collaborations are allowed. Any cheating will result in an automatic F in the course (not just in the assignment). If you have any doubts/questions, post your questions on D2L. You must discuss all project related issues on the Piazza discussion forum. We will give those who actively help others out by answering questions on the Piazza discussion forum up to 10 bonus points. Problem Statement: Finding a time that works for everyone to meet is often a headache issue, especially for a group of people. People often need to exchange availability through back-and-forth emails and allow for several days to finally schedule a meeting. With the help of a meeting scheduler that gives a power to book meetings with users efficiently, users can save hours of time on unnecessary emailing and focus on more important things. There exist some survey tools online to help a group find the best meeting time by manually filling a shared table with their availability. It could however be more productive if the scheduler can maintain the availability of all users and schedule the meeting at the time that works for everyone accordingly. In this project, we are going to develop a system to fasten the meeting scheduling process. The system receives a list of names involved in the meeting and returns the time intervals that work for every participant based on their availability. To maintain the privacy of everyone’s daily schedule, the availability of all users is stored on backend servers and cannot be accessed by any other servers or clients. Due to a large number of users, more than one backend servers are deployed to store their availability. A main server is then needed to manage which backend server a user’s information is stored in. The main server also plays a role of handling requests from clients. When a user wants to schedule a meeting among a group of people, the user will start a client program, enter all names involved in the meeting and request the main server for the time intervals that works for every participant. Once the main server receives the request, it decides which backend server the participants’ availability is stored in and sends a request to the responsible backend server for the time intervals that works for all participants belonging to this backend server. Once the backend server receives the request from the main server, it searches in the database to get all requested users’ availability, runs an algorithm to find the intersection 1 among them and sends the result back to the main server. The main server receives the time slots from different backend servers, runs an algorithm to get the final time slots that works for all participants, and sends the result back to the client. The scheduler then can decide the final meeting time according to the available time recommendations and schedule it in the involved users’ calendars. Without the loss of generality, we assume there are one client, one main server and two backend servers in our project, as indicated in Figure 1. The full process can be roughly divided into four phases: Boot-up, Forward, Schedule, Reply (read details in “Application Workflow Phase Description” section). ● Client: used to access the meeting scheduling system. ● Main server (serverM): coordinate with the backend servers. ● Backend server (serverA and serverB): store the availability of all users and get the time slots that work for all meeting participants once receiving requests. Figure 1: Illustration of the system Source Code Files Your implementation should include the source code files described below, for each component of the system. 1. ServerM (Main Server): You must name your code file: serverM.c or serverM.cc or serverM.cpp (all small letters except ‘M’). Also you must include the 2 corresponding header file (if you have one; it is not mandatory) serverM.h (all small letters except ‘M’). 2. Backend-Servers A and B: You must use one of these names for this piece of code: server#.c or server#.cc or server#.cpp (all small letters except for #). Also you must include the corresponding header file (if you have one; it is not mandatory). server#.h (all small letters, except for #). The “#” character must be replaced by the server identifier (i.e. A or B), depending on the server it corresponds to. (e.g., serverA.cpp & serverB.cpp) Note: You are not allowed to use one executable for all four servers (i.e. a “fork” based implementation). 3. Client: The name of this piece of code must be client.c or client.cc or client.cpp (all small letters) and the header file (if you have one; it is not mandatory) must be called client.h (all small letters). Input Files: There are two input files provided, a.txt for backend server A and b.txt for backend server B. Each file is accessible by its corresponding backend server only. The main server or client should not be able to access either of the files. Two files share the same format as follows. The file contains a list of time availability for a group of individuals identified by their usernames. The format of the time availability information stored in the file for a specific user is provided below. saylor;[[5,10],[11,16]] The format of each line will always be username;time_availability, ending with a newline character. Username and time availability are always separated by a semicolon. The username contains only small letter alphabets with a maximum length of 20. The usernames present in both the files are completely unique. The time availability consists of a list of time intervals in the format: [[t1_start,t1_end],[t2_start,t2_end]... [t10_start,t10_end]] Each time interval contains a start and an end time which are always non-negative 3 integers. The start and end times are separated by a comma, and the time intervals are also separated by a comma. The end time will always be larger than the start time, i.e., t[i]_start < t[i]_end,="" and="" the="" start="" time="" of="" the="" next="" time="" interval="" will="" always="" be="" larger="" than="" the="" end="" time="" of="" the="" current="" time="" interval,="" i.e.,="" t[i]_end="">< t[i+1]_start. each username can contain a maximum of 10 time intervals and a minimum of 1 time interval. if a user has only 1 time interval then the format would be: username;[[t1_start,t1_end]] the minimum start time for each username has to be at least 0 and the maximum end time of each username can not exceed 100. there can be spaces at any point in the line (except inside a username), you have to remove the extra spaces in your preprocessing. please find the following examples to see what is a valid or invalid line in the input files: saylor;[[0,100]] this is a valid line in the input files. saylor;[[1,2],[3,4],[5,6],[7,8],[9,10],[11,12],[13,14],[15,16],[17,1 8],[19,20]] this is a valid line in the input files. saylor;[[-1,10.5]] this is an invalid line because only non-negative integer times are allowed. such a line will not exist in the input files. sayl!or;[[a,10]] this is an invalid line because usernames should have only small letters and no special characters, other than the ones specified. time intervals will have digits only. such a line will not exist in the input files. saylor;[[1,101]] this is an invalid line because usernames should only have small letters. such a line will not exist in the input files. say lor;[[1,10],[11,12]] this is an invalid line because usernames should have small letters only and no spaces occur between the letters. such a line will not exist in the input files. saylor ;[[1 ,10] ,[11,12] ] this is a valid line. you should consider “saylor” as the username (ignoring all the whitespaces) and t1_start = 1 and t1_end = 10. 4 saylor;[[1,1]] this is an invalid line because end time should always be larger than start time. such a line will not exist in the input files. saylor;[[1,2],[2,3]] this is an invalid line because the start time of the second interval should be greater than the end time of the first interval. such a line will not exist in the input files. example a.txt and b.txt files are provided along with the project document for you to test your code on, these files contain only 10 lines, but the final grading will be performed on files which can contain up to 200 lines in each file. your code should be able to handle up to 200 lines in both files. you are encouraged to design more cases including edge cases to test your program. application workflow phase description: phase 1: boot-up please refer to the “process flow” section to start your programs in order of the main server, server a, server b and client. your programs must start in this order. each of the servers and the client have boot-up messages which have to be printed on screen, please refer to the on-screen messages section for further information. when two backend servers (server a and server b) are up and running, each backend server should read the corresponding input file and store the information in a certain data structure. you can choose any data structure that accommodates the needs. after storing all the data, server a and server b should then send all usernames they have to the main server via udp over the port mentioned in the port number allocation section. since the usernames are unique the main server will maintain a list of usernames corresponding to each backend server. in the following phases you have to make sure that the correct backend server is being contacted by the main server for corresponding usernames. you should print correct on screen messages onto the screen for the main server and the backend servers indicating the success of these operations as described in the “on-screen messages" section. after the servers are booted up and the required usernames are transferred from the backend servers to the main server, the client will be started. once the client boots up and the initial boot 5 up messages are printed, the client waits for the usernames to be taken as inputs from the user, the user can enter up to 10 usernames (all of which are separated by a single space). after booting up. your client should first show a prompt: please enter the usernames to check schedule availability: assuming one entered: theodore callie you should store the above two usernames (theodore and callie). once you have the usernames stored in your program, you can consider phase 1 of the project to be completed. you can proceed to phase 2. phase 2: forward once usernames involved in the meeting are entered in the client program, the client forms a message with these names and sends it to the main server over the established tcp connection. you can use any format for the message as long as the main server can receive the correct and intact list of usernames and can extract the information properly for the next step. the main server first examines if all usernames exist in the database of backend servers according to the username list received from two backend servers in phase 1. for the usernames that do not exist in the username list, it replies the client with a message saying that which usernames do not exist. for those that do exist, the main server splits them into two sublists based on where the user information is located and forwards those names to the corresponding backend server through udp connection. each of these servers have its unique port number specified in the “port number allocation” section with the source and destination ip address as “localhost” or “127.0.0.1”. client, main server and two backend servers are required to print out on-screen messages after executing each action as described in the “on-screen messages" section. these messages will help with grading in the event that the process does not execute successfully. missing some of the on-screen messages might result in misinterpretation that your process failed to complete. please follow the format when printing the on screen messages. phase 3: schedule once the backend servers receive the usernames, in order to help each participant schedule a common available time, in this phase, you will need to implement an algorithm to find the intersection of time availability of multiple users. 6 in the case of one participant, the backend server can directly send the time availability (i.e., a list of time intervals) back to the main server. in the case of two participants, for example alice and bob, the backend server should first search in its database and find the time availability of them. the time availability of alice and bob are two lists of time intervals as stated in the “input files” section, denoted as alice_time_list=[[t1_start,t1_end],[t2_start,t2_end],...] bob_time_list=[[t1_start,t1_end],[t2_start,t2_end],...] an algorithm should be developed with alice_time_list and bob_time_list as the input and output the intersection of time intervals of two lists. an illustration of time intervals and some example inputs and outputs are given in figure 2, in which the intersection between time intervals [5,10] and [8,11] which is [8,10] are considered as a valid intersection (and the two time lists can have more than one valid intersections) t[i+1]_start.="" each="" username="" can="" contain="" a="" maximum="" of="" 10="" time="" intervals="" and="" a="" minimum="" of="" 1="" time="" interval.="" if="" a="" user="" has="" only="" 1="" time="" interval="" then="" the="" format="" would="" be:="" username;[[t1_start,t1_end]]="" the="" minimum="" start="" time="" for="" each="" username="" has="" to="" be="" at="" least="" 0="" and="" the="" maximum="" end="" time="" of="" each="" username="" can="" not="" exceed="" 100.="" there="" can="" be="" spaces="" at="" any="" point="" in="" the="" line="" (except="" inside="" a="" username),="" you="" have="" to="" remove="" the="" extra="" spaces="" in="" your="" preprocessing.="" please="" find="" the="" following="" examples="" to="" see="" what="" is="" a="" valid="" or="" invalid="" line="" in="" the="" input="" files:="" saylor;[[0,100]]="" this="" is="" a="" valid="" line="" in="" the="" input="" files.="" saylor;[[1,2],[3,4],[5,6],[7,8],[9,10],[11,12],[13,14],[15,16],[17,1="" 8],[19,20]]="" this="" is="" a="" valid="" line="" in="" the="" input="" files.="" saylor;[[-1,10.5]]="" this="" is="" an="" invalid="" line="" because="" only="" non-negative="" integer="" times="" are="" allowed.="" such="" a="" line="" will="" not="" exist="" in="" the="" input="" files.="" sayl!or;[[a,10]]="" this="" is="" an="" invalid="" line="" because="" usernames="" should="" have="" only="" small="" letters="" and="" no="" special="" characters,="" other="" than="" the="" ones="" specified.="" time="" intervals="" will="" have="" digits="" only.="" such="" a="" line="" will="" not="" exist="" in="" the="" input="" files.="" saylor;[[1,101]]="" this="" is="" an="" invalid="" line="" because="" usernames="" should="" only="" have="" small="" letters.="" such="" a="" line="" will="" not="" exist="" in="" the="" input="" files.="" say="" lor;[[1,10],[11,12]]="" this="" is="" an="" invalid="" line="" because="" usernames="" should="" have="" small="" letters="" only="" and="" no="" spaces="" occur="" between="" the="" letters.="" such="" a="" line="" will="" not="" exist="" in="" the="" input="" files.="" saylor="" ;[[1="" ,10]="" ,[11,12]="" ]="" this="" is="" a="" valid="" line.="" you="" should="" consider="" “saylor”="" as="" the="" username="" (ignoring="" all="" the="" whitespaces)="" and="" t1_start="1" and="" t1_end="10." 4="" saylor;[[1,1]]="" this="" is="" an="" invalid="" line="" because="" end="" time="" should="" always="" be="" larger="" than="" start="" time.="" such="" a="" line="" will="" not="" exist="" in="" the="" input="" files.="" saylor;[[1,2],[2,3]]="" this="" is="" an="" invalid="" line="" because="" the="" start="" time="" of="" the="" second="" interval="" should="" be="" greater="" than="" the="" end="" time="" of="" the="" first="" interval.="" such="" a="" line="" will="" not="" exist="" in="" the="" input="" files.="" example="" a.txt="" and="" b.txt="" files="" are="" provided="" along="" with="" the="" project="" document="" for="" you="" to="" test="" your="" code="" on,="" these="" files="" contain="" only="" 10="" lines,="" but="" the="" final="" grading="" will="" be="" performed="" on="" files="" which="" can="" contain="" up="" to="" 200="" lines="" in="" each="" file.="" your="" code="" should="" be="" able="" to="" handle="" up="" to="" 200="" lines="" in="" both="" files.="" you="" are="" encouraged="" to="" design="" more="" cases="" including="" edge="" cases="" to="" test="" your="" program.="" application="" workflow="" phase="" description:="" phase="" 1:="" boot-up="" please="" refer="" to="" the="" “process="" flow”="" section="" to="" start="" your="" programs="" in="" order="" of="" the="" main="" server,="" server="" a,="" server="" b="" and="" client.="" your="" programs="" must="" start="" in="" this="" order.="" each="" of="" the="" servers="" and="" the="" client="" have="" boot-up="" messages="" which="" have="" to="" be="" printed="" on="" screen,="" please="" refer="" to="" the="" on-screen="" messages="" section="" for="" further="" information.="" when="" two="" backend="" servers="" (server="" a="" and="" server="" b)="" are="" up="" and="" running,="" each="" backend="" server="" should="" read="" the="" corresponding="" input="" file="" and="" store="" the="" information="" in="" a="" certain="" data="" structure.="" you="" can="" choose="" any="" data="" structure="" that="" accommodates="" the="" needs.="" after="" storing="" all="" the="" data,="" server="" a="" and="" server="" b="" should="" then="" send="" all="" usernames="" they="" have="" to="" the="" main="" server="" via="" udp="" over="" the="" port="" mentioned="" in="" the="" port="" number="" allocation="" section.="" since="" the="" usernames="" are="" unique="" the="" main="" server="" will="" maintain="" a="" list="" of="" usernames="" corresponding="" to="" each="" backend="" server.="" in="" the="" following="" phases="" you="" have="" to="" make="" sure="" that="" the="" correct="" backend="" server="" is="" being="" contacted="" by="" the="" main="" server="" for="" corresponding="" usernames.="" you="" should="" print="" correct="" on="" screen="" messages="" onto="" the="" screen="" for="" the="" main="" server="" and="" the="" backend="" servers="" indicating="" the="" success="" of="" these="" operations="" as="" described="" in="" the="" “on-screen="" messages"="" section.="" after="" the="" servers="" are="" booted="" up="" and="" the="" required="" usernames="" are="" transferred="" from="" the="" backend="" servers="" to="" the="" main="" server,="" the="" client="" will="" be="" started.="" once="" the="" client="" boots="" up="" and="" the="" initial="" boot="" 5="" up="" messages="" are="" printed,="" the="" client="" waits="" for="" the="" usernames="" to="" be="" taken="" as="" inputs="" from="" the="" user,="" the="" user="" can="" enter="" up="" to="" 10="" usernames="" (all="" of="" which="" are="" separated="" by="" a="" single="" space).="" after="" booting="" up.="" your="" client="" should="" first="" show="" a="" prompt:="" please="" enter="" the="" usernames="" to="" check="" schedule="" availability:="" assuming="" one="" entered:="" theodore="" callie="" you="" should="" store="" the="" above="" two="" usernames="" (theodore="" and="" callie).="" once="" you="" have="" the="" usernames="" stored="" in="" your="" program,="" you="" can="" consider="" phase="" 1="" of="" the="" project="" to="" be="" completed.="" you="" can="" proceed="" to="" phase="" 2.="" phase="" 2:="" forward="" once="" usernames="" involved="" in="" the="" meeting="" are="" entered="" in="" the="" client="" program,="" the="" client="" forms="" a="" message="" with="" these="" names="" and="" sends="" it="" to="" the="" main="" server="" over="" the="" established="" tcp="" connection.="" you="" can="" use="" any="" format="" for="" the="" message="" as="" long="" as="" the="" main="" server="" can="" receive="" the="" correct="" and="" intact="" list="" of="" usernames="" and="" can="" extract="" the="" information="" properly="" for="" the="" next="" step.="" the="" main="" server="" first="" examines="" if="" all="" usernames="" exist="" in="" the="" database="" of="" backend="" servers="" according="" to="" the="" username="" list="" received="" from="" two="" backend="" servers="" in="" phase="" 1.="" for="" the="" usernames="" that="" do="" not="" exist="" in="" the="" username="" list,="" it="" replies="" the="" client="" with="" a="" message="" saying="" that="" which="" usernames="" do="" not="" exist.="" for="" those="" that="" do="" exist,="" the="" main="" server="" splits="" them="" into="" two="" sublists="" based="" on="" where="" the="" user="" information="" is="" located="" and="" forwards="" those="" names="" to="" the="" corresponding="" backend="" server="" through="" udp="" connection.="" each="" of="" these="" servers="" have="" its="" unique="" port="" number="" specified="" in="" the="" “port="" number="" allocation”="" section="" with="" the="" source="" and="" destination="" ip="" address="" as="" “localhost”="" or="" “127.0.0.1”.="" client,="" main="" server="" and="" two="" backend="" servers="" are="" required="" to="" print="" out="" on-screen="" messages="" after="" executing="" each="" action="" as="" described="" in="" the="" “on-screen="" messages"="" section.="" these="" messages="" will="" help="" with="" grading="" in="" the="" event="" that="" the="" process="" does="" not="" execute="" successfully.="" missing="" some="" of="" the="" on-screen="" messages="" might="" result="" in="" misinterpretation="" that="" your="" process="" failed="" to="" complete.="" please="" follow="" the="" format="" when="" printing="" the="" on="" screen="" messages.="" phase="" 3:="" schedule="" once="" the="" backend="" servers="" receive="" the="" usernames,="" in="" order="" to="" help="" each="" participant="" schedule="" a="" common="" available="" time,="" in="" this="" phase,="" you="" will="" need="" to="" implement="" an="" algorithm="" to="" find="" the="" intersection="" of="" time="" availability="" of="" multiple="" users.="" 6="" in="" the="" case="" of="" one="" participant,="" the="" backend="" server="" can="" directly="" send="" the="" time="" availability="" (i.e.,="" a="" list="" of="" time="" intervals)="" back="" to="" the="" main="" server.="" in="" the="" case="" of="" two="" participants,="" for="" example="" alice="" and="" bob,="" the="" backend="" server="" should="" first="" search="" in="" its="" database="" and="" find="" the="" time="" availability="" of="" them.="" the="" time="" availability="" of="" alice="" and="" bob="" are="" two="" lists="" of="" time="" intervals="" as="" stated="" in="" the="" “input="" files”="" section,="" denoted="" as="" alice_time_list="[[t1_start,t1_end],[t2_start,t2_end],...]" bob_time_list="[[t1_start,t1_end],[t2_start,t2_end],...]" an="" algorithm="" should="" be="" developed="" with="" alice_time_list="" and="" bob_time_list="" as="" the="" input="" and="" output="" the="" intersection="" of="" time="" intervals="" of="" two="" lists.="" an="" illustration="" of="" time="" intervals="" and="" some="" example="" inputs="" and="" outputs="" are="" given="" in="" figure="" 2,="" in="" which="" the="" intersection="" between="" time="" intervals="" [5,10]="" and="" [8,11]="" which="" is="" [8,10]="" are="" considered="" as="" a="" valid="" intersection="" (and="" the="" two="" time="" lists="" can="" have="" more="" than="" one="" valid="">
Apr 09, 2023
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here