[cs631apue] Final Questions

kbodzak kbodzak at stevens.edu
Fri Dec 14 13:31:05 EST 2012

> Question 14 asks you to write one program.  This program will connect 
> to
> the IP address 2001:470:1f06:1a3::2 on port 3113 and then send the
> string specified as the first argument to the program.
>> How does the sending program know what information to send?
> The user specifies the string as the first argument:
> ./send hello           # your program sends the string "hello"
> ./send "hello there"   # your program sends the string "hello there"
> ./send 1               # your program sends the string "1"
>> And once there is no more data left, do both programs terminate
>> without doing anything else?
> Once the data has been sent, the your program will terminate.

For question 15:
The program then reads any messages sent by
any clients one line at a time and prints them
prefixed with the client's hostname.

Does this imply that we should be forking processes to listen for 
multiple connections?
(Since the question says to read messages sent by *any* clients).

... or should we only deal with the first client to connect, and then 
terminate when that client
closes the connection?

More information about the cs631apue mailing list