[ Team LiB ] Previous Section Next Section



Build the TCP server from Figures 5.2 and 5.3 and the TCP client from Figures 5.4 and 5.5. Start the server and then start the client. Type in a few lines to verify that the client and server work. Terminate the client by typing your EOF character and note the time. Use netstat on the client host to verify that the client's end of the connection goes through the TIME_WAIT state. Execute netstat every five seconds or so to see when the TIME_WAIT state ends. What is the MSL for this implementation?


What happens with our echo client/server if we run the client and redirect standard input to a binary file?


What is the difference between our echo client/server and using the Telnet client to communicate with our echo server?


In our example in Section 5.12, we verified that the first two segments of the connection termination are sent (the FIN from the server that is then ACKed by the client) by looking at the socket states using netstat. Are the final two segments exchanged (a FIN from the client that is ACKed by the server)? If so, when, and if not, why?


What happens in the example outlined in Section 5.14 if between Steps 2 and 3 we restart our server application on the server host?


To verify what we claimed happens with SIGPIPE in Section 5.13, modify Figure 5.4 as follows: Write a signal handler for SIGPIPE that just prints a message and returns. Establish this signal handler before calling connect. Change the server's port number to 13, the daytime server. When the connection is established, sleep for two seconds, write a few bytes to the socket, sleep for another two seconds, and write a few more bytes to the socket. Run the program. What happens?


What happens in Figure 5.15 if the IP address of the server host that is specified by the client in its call to connect is the IP address associated with the rightmost datalink on the server, instead of the IP address associated with the leftmost datalink on the server?


In our example output from Figure 5.20, when the client and server were on different endian systems, the example worked for small positive numbers, but not for small negative numbers. Why? (Hint: Draw a picture of the values exchanged across the socket, similar to Figure 3.9.)


In our example in Figures 5.19 and 5.20, can we solve the byte ordering problem by having the client convert the two arguments into network byte order using htonl, having the server then call ntohl on each argument before doing the addition, and then doing a similar conversion on the result?


What happens in Figures 5.19 and 5.20 if the client is on a SPARC that stores a long in 32 bits, but the server is on a Digital Alpha that stores a long in 64 bits? Does this change if the client and server are swapped between these two hosts?


In Figure 5.15, we say that the client IP address is chosen by IP based on routing. What does this mean?

    [ Team LiB ] Previous Section Next Section