TCP IP Illustrated

We can see this scenario using our sock program we

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: cannot reuse the same local port number. This isn't a problem, since clients normally use ephemeral ports, and don't care what the local ephemeral port number is. With servers, however, this changes, since servers use well-known ports. If we terminate a server that has a connection established, and immediately try to restart the server, the server cannot assign its well-known port number to its end point, since that port number is part of a connection that is in a 2MSL wait. It may take from 1 to 4 minutes before the server can be restarted. We can see this scenario using our sock program. We start the server, connect to it from a client, and then terminate the server: start as server, listening on port 6666 (execute client on bsdi that connects to this port) connection on 140.252.13.33.6666 from 140.252.13.35.1081 then type interrupt key to terminate server ^? and immediately try to restart server on same port sun % sock -s 6666 sun % sock -v -s 6666 file:///D|/Documents%20and%20Settings/bigini/Docu...homenet2run/tcpip/tcp-ip-illustrated/tcp_conn.htm (15 of 37) [12/09/2001 14.47.16] Chapter 18. TCP Connection Establishment and Termination can't bind local address: Address already in use let's check the state of the connection sun % netstat Active Internet connections Foreign Recv-Q Send-Q Local Address Proto Address sun.6666 tcp 0 0 bsdi.1081 many more lines that are deleted (state) TIME_WAIT When we try to restart the server, the program outputs an error message indicating it cannot bind its well-known port number, because it's already in use (i.e., it's in a 2MSL wait). We then immediately execute netstat to see the state of the connection, and verify that it is indeed in the TIME_WAIT state. If we continually try to restart the server, and measure the time until it succeeds, we can measure the 2MSL value. On SunOS 4.1.3, SVR4, BSD/386, and AIX 3.2.2, it takes 1 minute to restart the server, meaning the MSL is 30 seconds. Under Solaris 2.2 it takes 4 minutes to restart the server, implying an MSL of 2 minutes. We can see the same error from a client,...
View Full Document

Ask a homework question - tutors are online