TCP IP Illustrated

The second time we execute the client we specify the

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: if the client tries to allocate a port that is part of a connection in the 2MSL wait (something clients normally don't do): start as client, connect to echo server sun % sock -v bsdi echo connected on 140.252.13.33.1162 to 140.252.13.35.7 type this line hello there and it's echoed by the server hello there type end-of-file character to terminate client ^D sun % sock -b1162 bsdi echo can't bind local address: Address already in use The first time we execute the client we specify the -v option to see what the local port number is (1162). The second time we execute the client we specify the -b option, telling the client to assign itself 1162 as its local port number. As we expect, the client can't do this, since that port number is part of a connection that is in a 2MSL wait. We need to reemphasize one effect of the 2MSL wait because we'll encounter it in Chapter 27 with FTP, the File Transfer Protocol. As we said earlier, it is a socket pair (that is, the 4-tuple consisting of a local IP address, local port, remote IP address and remote port) that remains in the 2MSL wait. Although many implementations allow a process to reuse a port number that is part of a connection that is in the 2MSL wait (normally with an option named SO_REUSEADDR), TCP cannot allow a new connection to be created with the same socket pair. We can see this with the following experiment: file:///D|/Documents%20and%20Settings/bigini/Docu...homenet2run/tcpip/tcp-ip-illustrated/tcp_conn.htm (16 of 37) [12/09/2001 14.47.16] Chapter 18. TCP Connection Establishment and Termination start as server, listening on port 6666 (execute client on bsdi that connects to this port) on 140.252.13.33.6666 from 140.252.13.35.1098 then type interrupt key to terminate server -b6666 bsdi 1098 try to start as client with local port 6666 local address: Address already in use -A -b6666 bsdi try again, this time with -A option sun % sock -v -s 6666 connection ^? sun % sock can't bind sun % sock 1098 active open error: Address already in use The first time we run our so...
View Full Document

This test prep was uploaded on 04/04/2014 for the course ECE EL5373 taught by Professor Guoyang during the Spring '12 term at NYU Poly.

Ask a homework question - tutors are online