Re: bind/connect: correct behaviour?

Roderich Schupp (rsch@ExperTeam.de)
Mon, 08 Feb 1999 01:09:51 +0100


Andi Kleen <ak@muc.de> said:
> Yes. The three-way handshake for a listen socket proceeds asynchronous
> to the process. accept only sees connections when they are completely
> established.

Except that the program didn't do a listen(). The program is trying to
make a connection to the localhost's printer port, all it does is

(1) s = socket(...)
(2) bind(s, addr=0.0.0.0, port=515)
(3) connect(s, addr=127.0.0.1, port=515)

OK, normally you wouldn't need (2), but sometimes print spoolers are
picky about the client's port, so LPRng tries ports in a given range
which happens to default to 512 thru 1023, but ports 512/513/514 are already
bound (by inetd) and 515 is available (because no spooler is running)...
A fringe case?

Cheers, Roderich

-- 
Do not meddle in the affairs of wizards, for they are subtle and quick 
to anger.  Do not meddle in the affairs of dragons for you are crunchy 
and taste good with ketchup.  Do not meddle in the affairs of cats, for 
they are subtle and will piss on your computer.

Roderich Schupp mailto:rsch@ExperTeam.de ExperTeam GmbH http://www.experteam.de/ Munich, Germany linux:2.2.1

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/