STUN, TURN, ICE library for Java
Asked Answered
N

3

21

I need to establish a P2P UDP and TCP Connection between two Users. Both of them are behind a NAT.

A little research leads me to STUN, TURN and ICE.

Is there any Java solution (library) except jSTUN which seems to work only on UDP?

And TURN, ICE is much better for the symmetric NAT problem.

Norway answered 10/1, 2010 at 23:45 Comment(1)
have u been able to findout a solution ?Harriettharrietta
B
9

Not to toot my own horn too much, but might I recommend trying IcedJava. (It's a part of the SipTools project) It's actively being developed, has a stable release 0.9 version, and supports use cases like RTP streaming out of the box.

As far as TCP support, that's slated for a later release, but you're going to have a hard time supporting TCP over symmetric nat due to the three way handshake being blocked. Even the TCP extensions to the ICE specification note that TCP connections are much less likely to succeed than UDP connections between natted peers.

That said, you can workaround this by routing TCP packets over a UDP bridge, including all of the error correction and flow control features. (I forget the RFC for this, but it is a final specification) Still, all of these are relatively new specifications, and the ICE-TCP spec is not yet final. Even in active development, these will take time to implement.

Bedevil answered 17/12, 2010 at 5:43 Comment(5)
Is this project still maintained? Or has it been discontinued?Felt
The last commit was over 4 years agoFlamingo
Link is dead again.Grodin
I need to really pick up and put some work into this project. Link fixed (again)Bedevil
Is there any documentation?Dulin
L
8

There is also ice4j, which acording to the developers:

A Java implementation of the STUN and TURN and ICE protocols. This project is a continuation of the Stun4J initiative. The goal of the project is to provide VoIP Java developers with a means of handling NATs and firewalls.

it's been developed by the sipcommunicator devs.

Leucocytosis answered 24/10, 2011 at 10:44 Comment(3)
Beware the lack of documentation for Ice4jPortuna
I've been trying to wrap my head around ice4j for days, the best documentation I've found so far is a test case here github.com/jitsi/ice4j/blob/master/src/test/java/test/… , but I'm beginning to break down, perhaps I'll give JStun a shotDulin
@Dulin have u been able to figureout how to use ice4J ? I am looking for a java/node/or python library that i can use for p2p communication - dont need full webrtc supportHarriettharrietta
D
2

You could try jstunt - no longer maintained, but source seems to be available. They provide a jar with the STUNT library and example java server/client applications. From my reading, it's not native java, so this may only work on certain architectures.

Diluvium answered 11/1, 2010 at 10:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.