server.c
so that instead of copying from the network to
standard output, it does the following in a loop:
play_open_file
using the communication file descriptor
as the parameter.
client.c
so that instead of copying from standard input
to the network, it does the following:
record_to_open_file
using the communication file descriptor
as the parameter.
record_to_open_file
.
If threshold is negative, it is ignored. If the threshold
is positive, it is used to threshold the incoming audio. That is. After a
block has been read with read_audio
, if any of the bytes in the
read block are above the threshold, then the block is written. If all of the
bytes are below the threshold, the block is thrown away. The threshold
is used so that you won't be sending silence over the network. Modify your
client and server so that they each take the threshold value as a command line
argument.
Part II: A Two-way Network Intercom - Due April 3, 1998
Modify the client and server so that each forks a child after opening the audio
device. The child calls the record_to_open_file
while the
parent calls play_from_open_file
.