Netdev List
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Chris Friesen <chris.friesen@genband.com>
Cc: netdev@vger.kernel.org
Subject: Re: any way to let host act as TCP server OR client on same IP/port?
Date: Wed, 13 Jul 2011 19:52:00 +0200	[thread overview]
Message-ID: <1310579520.2509.17.camel@edumazet-laptop> (raw)
In-Reply-To: <4E1DC83C.3020506@genband.com>

Le mercredi 13 juillet 2011 à 10:30 -0600, Chris Friesen a écrit :
> I've been asked an interesting question about TCP.  We have some people 
> that want to set up a TCP socket that can listen for connections on a 
> given IP/port, but also initiate connections from that same IP/port. 
> (Only one at a time, of course.)
> 
> The TCP state machine seems to allow this (moving from LISTEN to 
> SYN_SENT) but it's not a normal transition.
> 
> Is there any way to do this using the socket API?
> 
> I thought up a hack whereby we could use NFQUEUE to detect an incoming 
> SYN and delay it while we call listen() on the socket.  Is there any 
> better way to do this?

Could you try SO_REUSEADDR, on both listener and connect attempt ?




  reply	other threads:[~2011-07-13 17:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-13 16:30 any way to let host act as TCP server OR client on same IP/port? Chris Friesen
2011-07-13 17:52 ` Eric Dumazet [this message]
2011-07-13 18:05   ` Rick Jones
2011-07-13 19:16     ` Chris Friesen
2011-07-13 20:36       ` Rick Jones
2011-07-13 22:28         ` Chris Friesen
2011-07-14 14:55       ` Chris Friesen
2011-07-14 16:45         ` Rick Jones
2011-07-14 17:33           ` Chris Friesen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1310579520.2509.17.camel@edumazet-laptop \
    --to=eric.dumazet@gmail.com \
    --cc=chris.friesen@genband.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox