I currently have two parties set up:

  • typical HTTP web server
  • native app distributed to consumers (presumably behind typical home router/firewall configuration)

The app is designed to work on certain small problems, but I want apps configured to work on similar problems to work together. Right now, the only solution I can come up with is passing all the data through the web server. However I was wondering if there is any protocol that will allow my native app to use the web server just to facilitate the initial TCP handshake and then continue without the web server relaying the information in the middle?

My desired flow would be like so:

  1. Web server waits around for connections
  2. Native app instance A connects to server and notifies it that A is working on problem (i)
  3. Native app instance B connects to server and notifies it that B is working on problem (i)
  4. Server matches A and B as working on similar problems and notifies them both to initiate a connection
  5. Both A and B send TCP SYN, SYN-ACK, ACK messages as appropriate to the web server, but then instead of using the traded TCP protocol parameters against the web server they continue to communicate directly with each other.


A. is such a flow possible?

B. is there a protocol that attempts to establish this?

If the answer to both of the above is "no" is there something else I can try to cut out the web server from middle-manning the communications?

  • 3
    You should take a look how WebRTC works, it has to solve the same problem as you have. Blog post explaining basics: innoarchitech.com/what-is-webrtc-and-how-does-it-work
    – Lycha
    Commented Feb 16, 2016 at 8:50
  • It is by design that two computers behind different firewalls can not directly communicate with eachother. There are workarounds, like UPnP which provides port mapping, but then the client is effectively not behind a firewall. It's just that, workaround.
    – Pieter B
    Commented Apr 15, 2016 at 8:14
  • If you are thinking that you can get a network connection to occur between two unrelated hosts because they both have a connection to a middle server, you are on to a loser. You want to bypass firewalls too, its just not going to happen. One client will have to make a connection to the other client, the middleman simply tells it which one to connect to.
    – gbjbaanb
    Commented Jun 14, 2016 at 7:46

1 Answer 1


Some home routers have support for UPnP which allows applications in the home network to configure port mappings, so that the router forwards traffic from the outside to the internal host.


This is commonly used by Torrent applications and some messaging programs as well as games. However many routers have this disabled for security reasons. In that case an server which can be reached by all participants is often the most reliable alternative.

  • This sounds about right and is in line with some advice I was given on IRC. It sounds like this form of communication doesn't exist but I feel like it definitely could. A program can already send any information it wants to the internet at large. Adding the capability for a third party to facilitate direct connections could create powerful additions to applications and reduce server bandwidth requirements at zero cost to the user or the company developing the application.
    – Barak Gall
    Commented Feb 16, 2016 at 6:08
  • The issue is that the hosts in the home network use don't use public IPs, but private ones and the router does NAT (network address translation) his becomes better wit IPv6 where we have enough public addresses to use. The remaining issue then are firewalls, which typically block incoming traffic by default ...
    – johannes
    Commented Feb 16, 2016 at 10:52
  • While I agree with the issues, I feel this can be solved even in the IPv4 namespace. It could be something like, Client A communicates with Facilitating open on the internet Host. Client B communicates with same host indicating that it would like to connect to Client A. Host mediates the original TCP sequence numbers to be used in the connection attempts. Both clients begin communicating with each other. I think this is feasible, but may require me to hand-craft the packets that initiate the connection. Which is outside of my scope.
    – Barak Gall
    Commented Feb 22, 2016 at 0:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.