RE: connecting a socket to itself

From: Jeff Haran
Date: Fri Apr 18 2008 - 13:24:45 EST


> -----Original Message-----
> From: linux-net-owner@xxxxxxxxxxxxxxx
> [mailto:linux-net-owner@xxxxxxxxxxxxxxx] On Behalf Of David Stevens
> Sent: Friday, April 18, 2008 9:44 AM
> To: Serge Belyshev
> Cc: linux-net@xxxxxxxxxxxxxxx
> Subject: Re: connecting a socket to itself
>
> Connecting a socket to itself is not an error.
>
> If you write to it, you can then read what you wrote.
>
> +-DLS

But nothing was listen()'ing on the port and nothing accept()'ed the
connection.

If you had similar code running on two different machines, each of which
attempted connections to the other machine, I would expect that they
would never connect because of the asymetric nature of the TCP SYN,
SYN/ACK, ACK connection sequence.

Shouldn't the sockets API work the same regardless of whether
addr.sin_addr.s_addr is the loopback address or not?

Jeff Haran
--
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