문제

I am trying to use some globally available STUN servers so that they can tell me my NAT mapping in order to traverse the NAT with UDP. The servers are on this webpage: http://www.tek-tips.com/faqs.cfm?fid=7542 I tested them and they do ping. The problem is constructing a special STUN request packet, because the servers don't respond on all incoming packets.

The packet structure for STUN protocol is not explained too good and I don't want to use any libraries that already implement it. Are there some examples of either Java/C code or a carefully explained packet structure? I cannot find any information about it.

도움이 되었습니까?

해결책

The STUN packet format is explained in perfect detail in RFC 5389.

If you want decent Java code for STUN - go take a look at JSTUN sources. It's pretty easy to use their library and/or modify their code.

If you want to use my code, written in C++, you can peruse the sources of Stuntman. There's both a parser class (CStunReader) and a class to create STUN messages (CStunWriter).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top