subject

For this lab, you are going to alter those send/receive loops in both vcsend and vcrec to instead use select() to determine whether to call send() or recv(). In the setup for select(), tell it to monitor both stdin and the data socket for read activities.
You will call send() when there is read activity on standard in, which indicates the user has typed something on the keyboard. If the user has typed just a period (.) on a line by itself that indicates that the user wishes to close the connection so you would close instead of calling send().

You will call recv() when there is read activity on the data socket. If recv() is successful (returns greater than 0), print the data to the screen. Otherwise (returns 0 or negative number), handle as the original vcrec. c handled those return values of recv().

Be sure to prompt the user for input in each iteration of the select() loop. The prompt can be any text you choose, but be sure to indicate that the user types '.' on a line by itself to close the connection.

Test your code by running vcrec in one terminal and then running vcsend in a second terminal. You must have two terminals running since both programs will be watching stdin. Have vcsend connect to vcrec's port. You should be able to type in either program whenever you want and have the data display via stdout on the other program. Both programs should terminate when you type '.' on a single line in either program.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 22:30
I'll mark brainliest if answered right! with which feature or menu option of a word processing program can you make an image like this? you can get this image using the option of a word processing program.
Answers: 1
question
Computers and Technology, 23.06.2019 03:30
Hashtags serve to identify the topic of a given tweet true false
Answers: 2
question
Computers and Technology, 23.06.2019 09:00
Which is the highest level of the hierarchy of needs model? a. humanity b. intrapersonal c. team d. interpersonal
Answers: 1
question
Computers and Technology, 23.06.2019 13:30
Stops: using the information learned in this course, explain three things you will not do when driving. a. b. c. explain why you will not do these things when driving. starts: using the information learned in this course, explain three things you will do when driving. a. b. c. explain why you will do these particular things when driving. explain one thing you will stop doing as a passenger. explain one thing you will start doing as a passenger.
Answers: 3
You know the right answer?
For this lab, you are going to alter those send/receive loops in both vcsend and vcrec to instead us...
Questions
question
Mathematics, 27.08.2020 23:01
question
English, 27.08.2020 23:01
question
English, 27.08.2020 23:01
question
German, 27.08.2020 23:01
Questions on the website: 13722360