Re: connecting an unbound socket to itself

From: David Miller
Date: Fri Apr 18 2008 - 18:39:59 EST


From: Serge Belyshev <belyshev@xxxxxxxxxxxxxxxxx>
Date: Sat, 19 Apr 2008 02:24:04 +0400

> But my socket is unbound and I'm connecting to a loopback address, so
> I expect the connection to fail if nobody listens on the port I am
> connecting to. Yet the connections succeedes on the rare occasion when
> the kernel chooses the source port number that matches the destination.

At the point you do a connect() you are "listening" on that
port and can be connected to.
--
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html