UNIX Network Programming Volume 1, Third Edition [Electronic resources] : The Sockets Networking API

Addison Wesley

نسخه متنی -صفحه : 450/ 56
نمايش فراداده

Exercises

3.1

Why must value-result arguments such as the length of a socket address structure be passed by reference?

3.2

Why do both the readn and writen functions copy the void* pointer into a char* pointer?

Figure A.10).

Write a new function named inet_pton_loose that handles these scenarios: If the address family is AF_INET and inet_pton returns 0, call inet_aton and see if it succeeds. Similarly, if the address family is AF_INET6 and inet_pton returns 0, call inet_aton and if it succeeds, return the IPv4-mapped IPv6 address.