Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!ucsd!ucbvax!bloom-beacon!eru!hagbard!sunic!nuug!ifi!enag From: enag@ifi.uio.no (Erik Naggum) Newsgroups: comp.protocols.tcp-ip Subject: Re: reuse of addresses when calling bind() Message-ID: Date: 1 Dec 90 13:03:03 GMT References: <86984@lll-winken.LLNL.GOV> <1990Nov30.202155.8253@bwdls61.bnr.ca> <87047@lll-winken.LLNL.GOV> Sender: enag@ifi.uio.no (Erik Naggum) Organization: Naggum Software, Oslo, Norway Lines: 33 Nntp-Posting-Host: svarte.ifi.uio.no In-Reply-To: booloo@lll-crg.llnl.gov's message of 30 Nov 90 23:13:35 GMT Originator: enag@svarte.ifi.uio.no In article <87047@lll-winken.LLNL.GOV>, Mark Boolootian writes: Unfortunately, I still don't see how this particular error [EADDRINUSE] can occur once the socket has been correctly setsockopt()'ed. A TCP connection is uniquely identified by the 4-tuple where R means Remote and L Local, a total of 96 bits! Given that you always have a peer in an established connection, I have never understood what you gain from defaulting to consider only the pair for uniqueness. Seems silly. Even with several processes listen()ing to the same Lport, it isn't a problem, since the TCP handler will arbitrarily assign a connection to one of the waiting processes, and thereafter the connection is uniquely identified. Can someone with first-hand experience tell me why BSD sockets don't default to "reusing" addresses? (I think "reuse" is a misnomer, too, since it's not actually reused, unless you narrow your view to the local pair, sort of like thinking that the horizon is a place.) However, there is a chance that things may go astray. If a broken application (say, one which always calls out on the SMTP port (25), instead of getting a fresh Lport) attempts to connect to the same host on the same port (say, SMTP), the 96-bit connection "identifier" is already in use. In most of the implementations of TCP that I have seen, you would have to work _real_hard_ to accomplish this. (At least I would have to work real hard, others may find it obvious that it should be done that way, and complain about how stupid TCP is. :-) -- [Erik Naggum] Snail: Naggum Software / BOX 1570 VIKA / 0118 OSLO / NORWAY Mail: , My opinions. Wail: +47-2-836-863 Brought to you by Super Global Mega Corp .com