Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Prints its id and \" id num : Sending <filename>, <numBytes> bytes\ \" Sends the

ID: 3845406 • Letter: P

Question

Prints its id and "id num: Sending <filename>, <numBytes> bytes "

Sends the size of the file as a uint32_t integer to the client (in network endian)

Sends the bytes of the file to the client. It should send the file in buffers of bytes of size BUFFER_LEN.

close()s what it should close.

returns NULL.

Code:

Sample output:

To properly test this program I made a directory called Dir:

I also made a file that I did have permission to read called holdYourHeadUp.txt, and one that I did not called youCantOpenMe.txt. The contents of the second file can be whatever you want, but to make it so you cannot open it say:

My directory now has:

Client output: Server output:
       
  $ ./server   Please enter port number to monopolize [1025-65535]: 2000            
                 
             
               
             
             
             
  $ ./client   Machine name [localhost]? (I just pressed enter)   Port number? 2000  Please enter a letter to look for: h  The file that matches h has size 437  And if it's bad  Don't let it get you down, you can take it  And if it hurts  Don't let them see you cry, you can make it    Hold your head up, woman  Hold your head up, woman  Hold your head up, woman  Hold your head high  Hold your head up, woman  Hold your head up, woman  Hold your head up, woman  Hold your head high    And if they stare  Just let them burn their eyes on you moving  And if they shout  Don't let it change a thing that you're doing            
The server can open holdYourHeadUp.txt, so it sends it to the client.
  3: Sending holdYourHeadUp.txt, 437 bytes  And if it's bad  Don't let it get you down, you can take it  And if it hurts  Don't let them see you cry, you can make it    Hold your head up, woman  Hold your head up, woman  Hold your head up, woman  Hold your head high  Hold your head up, woman  Hold your head up, woman  Hold your head up, woman  Hold your head high    And if they stare  Just let them burn their eyes on you moving  And if they shout  Don't let it change a thing that you're doing            

Explanation / Answer

1. void* handleClient (void* vPtr)

2.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote