Question: In C++ with three files listed below. 1. Domain Socket parent (possibly just a header file), 2. Child of Domain Socket that provides Server method(s),

In C++ with three files listed below.

1. Domain Socket parent (possibly just a header file),

2. Child of Domain Socket that provides Server method(s), and

3. Child of Domain Socket that provides Client method(s).

This project explores usage of the IPC in the form of Unix Domain Sockets. Your task is to create a client/server pair to process large text files to find and transmit lines of text containing given search strings. In general, your task is to create a client which uses a Unix Domain Socket to send the name of a de- sired CSV file along with search terms to the server. The server will find all lines containing all or part of the terms and return each one using the Domain Socket. The client will format the lines and print each one, line-by-line (each line will end in a newline char). Server The server should be started with a single command-line argumentthe name of the domain socket it will build and monitor, i.e., ./text-server csv server socket If the server does not execute as indicated, the project will receive 0 points. The server must perform as follows: Build a Unix Domain Socket using the provided file name in the argument and begin listening for client connections A server should host n 1 clients, where n is the number of execution contexts on the machine it is executing.1 2 The get nprocs conf function can be used to determine n. After the accept function returns, the server must write "SERVER STARTED" "\tMAX CLIENTS: 7" to its terminals STDLOG (use std::clog and std::endl from iostream if using C++), where 7 is the number of execution contexts - 1. Accept incoming connections from clients, When a client connects, the server must write "CLIENT CONNECTED" to its terminals STDLOG.3 3. For each client connection, a server must acquire n strings from the Domain Socket, (a) The name and path to a file (relative to the project directory) When the path is determined, the server must write PATH: followed by the provided path name on a line to the terminals STDLOG, e.g. PATH: dat/dante.txt (b) A set of operator delimited search terms and operators; when the search tokens are parsed, the server must write Operation: followed by n/a, AND, or OR, depending on the operators discovered or their lack SEEKING: followed by a comma-delimited list of tokens to the terminals STDLOG, e.g. SEEKING: default, industrial For example, Input default would result in OPERATION: n/a SEEKING: default Input default + industrial would result in OPERATION: OR SEEKING: default, industrial Input default x industrial would result in OPERATION: AND SEEKING: default, industrial 4. Using the path to open the indicated file 1An execution context is a CPU core (or virtual core using techniques like hyper-threading). 2Note that you do not actually have to thread your server, only build the groundwork for future threading. 3Use std::clog and std::endl from iostream if using C++. Cont. (a) Use Domain Socket to send INVALID FILE instead of file lines if file cannot be opened or read (b) Close the clients connection, and (c) Wait for next connection Parse the file, line-by-line, and send any line containing the provided search expression to the client via the domain socket After parsing the file and writing all lines to the client, the server must print the number of bytes (characters) of text lines transmitted to the client: BYTES SENT: 745 Ensure bytes/chars are counted on the server as will be on the client. The client must calculate the same value by counting the number of characters it is sent from the text files. 7. The server need not exit Files included: exe.sh: #!/user/bin/env bash # executable variables # SERVER="text-server" # CLIENT="text-client" # clean things up before beginning # rm $SERVER_FILES rm $CLIENT_FILES make clean # build applications make $SERVER make $CLIENT # test 1 execution parameters # SOCKET_NAME1="csv_server1" FILE1="dat/bankloan1.csv" SEARCH_STR1="default" # output variables # SERVER_MSG1="exe1_server_out.txt" SERVER_LOG1="exe1_server_log.txt" SERVER_FILES1="$SERVER $SERVER_MSG1 $SERVER_LOG1" # CLIENT_MSG1="exe1_client_out.txt" CLIENT_LOG1="exe1_client_log.txt" CLIENT_FILES="$CLIENT $CLIENT_MSG1 $CLIENT_LOG1" # start server # echo "./$SERVER $SOCKET_NAME1 1> $SERVER_MSG1 2> $SERVER_LOG1 &" ./$SERVER $SOCKET_NAME1 1> $SERVER_MSG1 2> $SERVER_LOG1 & # remember PID to kill later SERVER_PID=$! # start client # echo "./$CLIENT $SOCKET_NAME1 $FILE1 $SEARCH_STR1 1> $CLIENT_MSG1 2> $CLIENT_LOG1" ./$CLIENT $SOCKET_NAME1 $FILE1 $SEARCH_STR1 1> $CLIENT_MSG1 2> $CLIENT_LOG1 sleep 1 # kill server # kill $SERVER_PID # server exe variables # SERVER_MSG2="exe2_server_out.txt" SERVER_LOG2="exe2_server_log.txt" SERVER_FILES1="$SERVER $SERVER_MSG2 $SERVER_LOG2" # client exe variables # CLIENT_MSG2="exe2_client_out.txt" CLIENT_LOG2="exe2_client_log.txt" # test 2 execution parameters # SOCKET_NAME2="csv_server2" FILE2="dat/bankloan1.csv" SEARCH_STR2="default + industrial" # test 2 master files # # start server # echo "./$SERVER $SOCKET_NAME2 1> $SERVER_MSG2 2> $SERVER_LOG2 &" ./$SERVER $SOCKET_NAME2 1> $SERVER_MSG2 2> $SERVER_LOG2 & # remember PID to kill later SERVER_PID2=$! # start client # echo "./$CLIENT $SOCKET_NAME2 $FILE2 $SEARCH_STR2 1> $CLIENT_MSG2 2> $CLIENT_LOG2" ./$CLIENT $SOCKET_NAME2 $FILE2 $SEARCH_STR2 1> $CLIENT_MSG2 2> $CLIENT_LOG2 # kill server # kill $SERVER_PID2 Thanks in advance

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!