[ Team LiB ] Previous Section Next Section



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


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


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


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)?


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., 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?


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