-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDetailed Requirements.txt
More file actions
83 lines (52 loc) · 5.36 KB
/
Detailed Requirements.txt
File metadata and controls
83 lines (52 loc) · 5.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
Introduction
In this client-server project, a client can request a file or a set of files from the server. The server searches for the file/s in its file directory rooted at its ~ and returns the file/files requested to the client (or an appropriate message otherwise). Multiple clients can connect to the serverw from different machines and can request file/s as per the commands listed in section 2
• The server, mirror1 and mirror2 and the client processes must run on different machines/terminals and must communicate using sockets only.
Section 1-Server (serverw24)
• serverw24 and two identical copies of the serverw24 called the mirror1 and mirror2 [see section 3] must run before any of the client (s) run and they must wait for request/s from client/s
• Upon receiving a connection request from a client, serverw24 forks a child process that services the client request exclusively in a function called crequest() and ( serverw24) returns to listening to requests from other clients.
o The crequest() function enters an infinite loop waiting for the client to send a command
o Upon the receipt of a command from the client, crequest() performs the action required to process the command as per the requirements listed in section 2 and returns the result to the client
• Upon the receipt of quitc from the client, crequest() exits.
• Note: for each client request, serverw24 must fork a separate process with the crequest() function to service the request and then go back to listening to requests from other clients
Section 2 (clientw24)
The client process runs an infinite loop waiting for the user to enter one of the commands.
Note: The commands are not Linux commands and are defined(in this project) to denote the action to be performed by the serverw24.
Once the command is entered, the client verifies the syntax of the command and if it is okay, sends the command to the serverw24, else it prints an appropriate error message.
List of Client Commands:
• dirlist -a the serverw24 must return the list of subdirectories/folders(only) under its home directory in the alphabetical order and the client must print the same
o ex: clientw24$ dirlist -a
• dirlist -t the serverw24 must return the list of subdirectories/folders(only) under its home directories in the order in which they were created (with the oldest created directory listed first) and the client must print the same
o ex: clientw24$ dirlist -t
• w24fn filename
o If the file filename is found in its file directory tree rooted at ~, the serverw24 must return the filename, size(in bytes), date created and file permissions to the client and the client prints the received information on its terminal.
Note: if the file with the same name exists in multiple folders in the directory tree rooted at ~, the serverw24 sends information pertaining to the first successful search/match of filename
Else the client prints “File not found”
o Ex: client24$ w24fs sample.txt
• w24fz size1 size2
o The serverw24 must return to the client temp.tar.gz that contains all the files in the directory tree rooted at its ~ whose file-size in bytes is >=size1 and
<=size2
size1 < = size2 (size1>= 0 and size2>=0)
o If none of the files of the specified size are present, the serverw24 sends “No file found” to the client (which is then printed on the client terminal by the client)
o Ex: client24$ w24fz 1240 12450
• w24ft <extension list> //up to 3 different file types
o the serverw24 must return temp.tar.gz that contains all the files in its directory tree rooted at ~ belonging to the file type/s listed in the extension list, else the serverw24 sends the message “No file found” to the client (which is printed on the client terminal by the client)
o The extension list must have at least one file type and can have up to 3 different file types
o Ex: client24$ w24ft c txt
o client24$ w24ft jpg bmp pdf
• w24fdb date
o The serverw24 must return to the client temp.tar.gz that contains all the files in the directory tree rooted at ~ whose date of creation is <=date
o Ex: client24$ w24fdb 2023-01-01
• w24fda date
o The serverw24 must return to the client temp.tar.gz that contains all the files in the directory tree rooted at ~ whose date of creation is >=date
o Ex: client24$ w24fda 2023-03-31
• quitc The command is transferred to the serverw24 and the client process is terminated
Note: All files returned from the serverw24 must be stored in a folder named w24project in the home directory of the client.
Note:
• It is the responsibility of the client process to verify the syntax of the command entered by the user (as per the rules in Section 3) before processing it.
o Appropriate messages must be printed when the syntax of the command is incorrect.
Section 3 Alternating Between the serverw24, mirror1 and mirror2
• The serverw24, mirror1 and mirror2 (mirror1 and mirror2 are serverw24’s copies possibly with a few additions/changes) are to run on three different machines/terminals.
• The first 3 client connections are to be handled by the serverw24.
• The next 3 connections (4-6) are to be handled by the mirror1.
• The next 3 connections (7-9) are to be handled by mirror2
• The remaining client connections are to be handled by the serverw24, mirror1 and mirror2 in an alternating manner- (ex: connection 10 is to be handled by the serverw24, connection 11 by the mirror, connection 12 by mirror2 and so on…)