[ Team LiB ] Previous Section Next Section



We said that a descriptor set can be assigned to another descriptor set across an equals sign in C. How is this done if a descriptor set is an array of integers? (Hint: Look at your system's <sys/select.h> or <sys/types.h> header.)


When describing the conditions for which select returns "writable" in Section 6.3, why did we need the qualifier that the socket had to be nonblocking for a write operation to return a positive value?


What happens in Figure 6.9 if we prepend the word "else" before the word "if" on line 19?


In our example in Figure 6.21 add code to allow the server to be able to use as many descriptors as currently allowed by the kernel. (Hint: Look at the setrlimit function.)


Let's see what happens when the second argument to shutdown is SHUT_RD. Start with the TCP client in Figure 5.4 and make the following changes: Change the port number from SERV_PORT to 19, the chargen server (Figure 2.18); then, replace the call to str_cli with a call to the pause function. Run this program specifying the IP address of a local host that runs the chargen server. Watch the packets with a tool such as tcpdump (Section C.5). What happens?


Why would an application call shutdown with an argument of SHUT_RDWR instead of just calling close?


What happens in Figure 6.22 when the client sends an RST to terminate the connection?


Recode Figure 6.25 to call sysconf to determine the maximum number of descriptors and allocate the client array accordingly.

    [ Team LiB ] Previous Section Next Section