Problem with binding of socket addresses

Les Hill leh at atlantis.cis.ufl.edu
Thu Dec 13 07:54:12 AEST 1990


In article <1990Dec10.194130.20414 at athena.mit.edu>, jik at athena.mit.edu (Jonathan I. Kamens) writes:

|>   Using the reuse address socket option will make it possible for you to
|> rebind to the socket.  It's also a violation of the TCP protocol.  But what
|> the hell, sometimes pragmatism has to win out over theory.  This is definitely
|> one of those times :-).

Ummm... I think you got it backwards, the SO_REUSEADDR allows you to override a restriction on sockets (namely each bound INET socket must be bound to a unique local port/local address combination) -- the TCP protocol allows TCP connections to be specified by local port/local address + foriegn port/foriegn address pairs (at least it did when I read RFC 793 :) which probably caused consternation among the socket mechanism developers who had to deal with passive TCP sockets waiting on *any* foriegn address. 






 I would like to hear an authoritative answer to this question:
	if you set SO_REUSEADDR on a socket, connect to a foreign address, and drop
	the connection, while someone else (also using SO_REUSEADDR :) issues a bind
	for the same local port, will the bind call allow you to rebind to the local
	port/local address within 2*MSL of your drop?  If so, what if you proceed
	with a connect?  This would explain why some code checks for EADDRINUSE
	even after doing a SO_REUSEADDR (then again those folks and I could just be
	taking "useless" precautions :->

Les
-- 
Extraordinary crimes against the people and the state have to be avenged by
agents extraordinary.  Two such people are John Steed -- top professional, and
his partner, Emma Peel -- talented amateur; otherwise known as "The Avengers."
UUCP: ...!gatech!uflorida!leh    BITNET: vishnu at UFPINE    INTERNET: leh at ufl.edu



More information about the Comp.unix.programmer mailing list