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?