aboutsummaryrefslogtreecommitdiffstats
path: root/P3/server.c
diff options
context:
space:
mode:
Diffstat (limited to 'P3/server.c')
-rw-r--r--P3/server.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/P3/server.c b/P3/server.c
index 868e0fe..0226e41 100644
--- a/P3/server.c
+++ b/P3/server.c
@@ -131,9 +131,30 @@ int main(int argc, char **argv) {
}
// Get the input args
-
+ int port = argv[3];
+ char* path = argv[4];
+ int dispatchers = argv[5];
+ int workers = argv[6];
+ int dynFlag = argv[7];
+ int qLen = argv[8];
+ int cSiz = argv[9];
// Perform error checks on the input arguments
-
+ if (port < 1025 || port > 65535) {
+ perror("Invalid port. Port must be greater than 1024 or less than 65536.\n");
+ return -1;
+ }
+ if (dispatchers > MAX_THREADS || dispatchers < 1) {
+ perror("Number of dispatchers is invalid. It must be greater than 0 or less than 101.\n");
+ return -1;
+ }
+ if (workers > MAX_THREADS || workers < 1) {
+ perror("Number of dispatchers is invalid. It must be greater than 0 or less than 101.\n");
+ return -1;
+ }
+ if (qLen > MAX_queue_len || qLen <= 0) {
+ perror("Queue length is invalid.\n");
+ return -1;
+ }
// Change SIGINT action for grace termination
// Open log file