Question: In this peer - to - peer application, the program enters a loop that: a . Calls kbhit ( ) to see if a key
In this peertopeer application, the program enters a loop that:
a Calls kbhit to see if a key has been hit on the local keyboard of the RPi.
b If a key has been hit, use fgets to read in a string from file stdin
c After fgets returns, take the string from fgets and send the string
to the remote port using sendUdpData following the requirements
in the Sending UDP Messages Section
d If QUIT was returned at the start of the string returned by fgets
exit the loop and close the listener port following the requirements
in the Shutdown Section
e Attempt to receive a message from the remote port using
receiveUdpData following the requirements
in the Receiving UDP Messages Section
f If data has been received, print the data in the right column
g If QUIT was received, exit the loop and close the listener port following
the requirements in the Shutdown Section
h Repeat ag until the program exits
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
