Answer the question
In order to leave comments, you need to log in
How to use stun correctly?
Interested in a superficial algorithm for working with stun udp to bypass Nat. Let's go without a specific programming language. I see it like this:
Answer the question
In order to leave comments, you need to log in
Well, using STUN itself is quite simple - go to the server and get your external IP + port, which is what you wrote about.
The question, it turns out, is more about how to organize NAT penetration using STUN, that is, signaling.
In general, an exhaustive answer is given in RFC 5245 - Interactive Connectivity Establishment (ICE) (used in WebRTC).
More understandable language from Mozilla .
Note that the diagrams first createRTCPeerConnection
, what is Caller, what is Callee. I'm not quite aware of what happens under the hood, but I can assume that a listening socket is first created, because there is already a request to the STUN server, which "pierces" the routing table and returns the "pierced" external port + address, which is sent to another node, and only then another node can connect to the "broken" external port.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question