Download





Exercises

4.1

In Section 4.4, we stated that the INADDR_ constants defined by the <netinet/in.h> header are in host byte order. How can we tell this?

4.2

Modify Figure to call getsockname after connect returns successfully. Print the local IP address and local port assigned to the TCP socket using sock_ntop. In what range (Figure) are your system's ephemeral ports?

4.3

In a concurrent server, assume the child runs first after the call to fork. The child then completes the service of the client before the call to fork returns to the parent. What happens in the two calls to close in Figure?

4.4

In Figure, first change the server's port from 13 to 9999 (so that we do not need super-user privileges to start the program). Remove the call to listen. What happens?

4.5

Continue the previous exercise. Remove the call to bind, but allow the call to listen. What happens?



     Python   SQL   Java   php   Perl 
     game development   web development   internet   *nix   graphics   hardware 
     telecommunications   C++ 
     Flash   Active Directory   Windows