subject

C Programming Sockets
Low-level I/O in C
Processes and signalling
5 code blocks total in server_getFileByFirstLetter. c
Please finish the server of a client-server application. The client asks the user for a letter (a character in {A-Z, a-z}), and then sends that letter to the server. The server fork()s a child to handle the client, and that child process:
1. Gets the letter from the client
2. Attempts to open the current directory ("."). If it cannot open that directory then it:
-sends CANT_READ_DIR_CODE back to the client (in network endian),
-prints "Cannot read directory\n",
-returns.
3. Iterates thru the directory to looking for a file (not a directory or anything else) whose name starts with the letter obtained from the client.
4. If the server finds no matching file then it
-sends NO_MATCH_CODE back to the client (in network endian),
-prints "No matching file\n",
-returns.
5. Attempts to open the file for reading. If it cannot open the file then it:
-sends CANT_READ_FILE_CODE back to the client (in network endian),
-prints "Cannot read file \n",
-returns.
6. Prints "Sending , bytes\n"
7. Sends the size of the file as a uint32_t integer to the client (in network endian)
8. Sends the bytes of the file to the client. It should send the file in buffers of bytes of size BUFFER_LEN.
9. close()s what it should close.
Code: Complete the five your code here sections in server_getFileByFirstLetter. c program. Two additonal files are below for reference:

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 04:00
Which of the following kinds of programs displays an online advertisement in a banner or pop-up window on webpages, email, or other internet service? e
Answers: 2
question
Computers and Technology, 22.06.2019 08:00
Two technicians are discussing the common u-joint. technician a says its input and output speeds should be equal. technician b says that it normally has two yokes. which technician is correct?
Answers: 1
question
Computers and Technology, 22.06.2019 15:20
The north and south regions had very diferent economies in the 1800s.
Answers: 1
question
Computers and Technology, 22.06.2019 15:30
Why would a programmer use the logical operator and in an if statement? a: when an action is to be taken that requires both conditions to be falseb: when an action is to be taken that requires both conditions to be truec: when an action is to be taken that requires the first condition to be falsed: when an action is to be taken that requires the second condition to be truei took the test and the answer is b.
Answers: 3
You know the right answer?
C Programming Sockets
Low-level I/O in C
Processes and signalling
5 code blocks t...
Questions
question
Mathematics, 23.10.2021 09:20
question
Mathematics, 23.10.2021 09:20
question
Mathematics, 23.10.2021 09:20
Questions on the website: 13722363