Path: utzoo!utgpu!watserv1!watmath!att!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!wuarchive!mit-eddie!bloom-beacon!eru!hagbard!sunic!nuug!ifi!enag From: enag@ifi.uio.no (Erik Naggum) Newsgroups: comp.protocols.tcp-ip Subject: Re: Can a receiving application change window size? Message-ID: Date: 10 Dec 90 09:47:58 GMT References: <87439@lll-winken.LLNL.GOV> Sender: enag@ifi.uio.no (Erik Naggum) Organization: Naggum Software, Oslo, Norway Lines: 36 Nntp-Posting-Host: hild.ifi.uio.no In-Reply-To: booloo@lll-crg.llnl.gov's message of 7 Dec 90 16:51:52 GMT Originator: enag@hild In article <87439@lll-winken.LLNL.GOV> booloo@lll-crg.llnl.gov (Mark Boolootian) writes: btw, I had previously asked how it was possible for bind() to return EADDRINUSE once SO_REUSEADDR had been set on a socket. Unfortunately, nobody has been able to provide (what I consider to be) a satisfactory answer. I'd still really like to know... It seems, after discussing this with numerous people for a while (whose names are unfortunately hidden in my mailbox at work, not here at the U), that the rationale was to be able to find sockets that were not in use, without adding a lot of overhead to the connect() call. Instead, if a _port_ is in use when you do the bind() with port specified, you get EADDRINUSE. This doesn't make much sense in normal TCP/IP ways, but the folks at Berkeley had this great idea about security with rlogin (etc), so they demanded that the port number of the caller be in the range 512-1024, i.e. within the privileged range in their own systems. Now, how to find an unused port in a specific range? Trial and error, basically. The half-way right way to do it, however, is a system call specifying the low end and the high end of the range you need. The kernel knows which ports are in use, and can give you a port in the range you request. The kernel can also ensure that you don't get a port which has just recently beed closed unilaterally. Finally, the truly _right_ solution is not to depend on port ranges at all, rendering the whole stupid question moot. I hope this has cleared things up a bit, although I would agree that the rationale is utterly bogus, and doesn't make any sense, except in the absence of rational design. BSD = Bogus Software Design. -- [Erik Naggum] Snail: Naggum Software / BOX 1570 VIKA / 0118 OSLO / NORWAY Mail: , My opinions. Wail: +47-2-836-863 ISO 8859-1: [\] FXE FXE {|} fxe fxe