2 ms·
According to [1], section 4.2: > From the same local TCP ports that $A$ and $B$ used to register with $S$, $A$ and $B$ each asynchronously make outgoing connec
by IgorPartola 15y ago
According to [1], section 4.2:
> From the same local TCP ports that $A$ and $B$ used to register with $S$, $A$ and $B$ each asynchronously make outgoing connection attempts to the other's public and private endpoints as reported by $S$, while simultaneously listening for incoming connections on their respective local TCP ports.
This makes it sound like both hosts have to listen for incoming connections: there is no way to hijack a TCP session and redirect it to a different host on the fly (aside from some very special circumstances where you have set up anycast and TCP session sharing, which you wouldn't be able to do in a network you do not fully control).
Also, AFAI remember, the WebSockets API is a step above TCP: you ask the browser to make a connection to endpoint S, and it negotiates the connection by asking the server if it supports not just TCP, but WebSockets and from where, etc. Thus the example from [1] would get much more complicated: you now have to make sure the browser not only performs the normal WebSocket setup, but then makes a new connection to a different server, while simultaneously listening for an incoming connection: not something, I believe, a part of the WebSockets spec.
[1] http://www.brynosaurus.com/pub/net/p2pnat/ http://www.brynosaurus.com/pub/net/p2pnat/