[ Team LiB ] Previous Section Next Section

Exercises

22.1

In Figure 22.18, why are there two calls to printf?

22.2

Can dg_send_recv (Figures 22.8 and 22.9) ever return 0?

22.3

Recode dg_send_recv to use select and its timer instead of using alarm, SIGALRM, sigsetjmp, and siglongjmp.

22.4

How can an IPv4 server guarantee that the source address of its reply equals the destination address of the client's request (e.g., functionality similar to that provided by the IPV6_PKTINFO socket option)?

22.5

The main function in Section 22.6 is protocol-dependent on IPv4. Recode it to be protocolindependent. Require the user to specify one or two command-line arguments, the first being an optional IP address (e.g., 0.0.0.0 or 0::0) and the second being a required port number. Then call udp_client just to obtain the address family, port number, and length of the socket address structure.

What happens if you call udp_client, as suggested, without specifying a hostname argument because udp_client does not specify the AI_PASSIVE hint to getaddrinfo?

22.6

Run the client in Figure 22.6 to an echo server across the Internet after modifying the RTT functions to print each RTT. Also, modify the dg_send_recv function to print each received sequence number. Plot the resulting RTTs along with the estimators for the RTT and its mean deviation.


    [ Team LiB ] Previous Section Next Section