3

While looking for ICE/STUN libraries for a peer-to-peer Java application, I ran into a problem. I needed to be able to ensure reliable delivery. All Java ICE libraries that I could find offered UDP hole punching (via the STUN protocol), but not TCP hole punching. I want peers to be able to reliably send files to one another over a network without needing a server, but UDP is not reliable. How do I get reliable, cross platform, peer-to-peer data delivery?

  • The sad truth is, that NAT traversal (and thus STUN) is not possible with TCP because of stateful firewalls. The solution to this is to switch to a different reliable protocol that builds upon UDP, like UDT – piegames Aug 12 '21 at 14:01

1 Answers1

2

I have done a little research and have found this solution, know as "pseudo-TCP" - for example: http://nice.freedesktop.org/libnice/libnice-Pseudo-TCP-Socket.html

Pseudo-TCP is reliable and also available in Java,

See:

https://github.com/opentelecoms-org/ice4j/blob/master/test/test/IcePseudoTcp.java

(^ from the ICE4J library^)

And also:

https://code.google.com/p/ice4j/source/browse/trunk/src/org/ice4j/pseudotcp/PseudoTcpSocket.java?r=335

  • There is also the [UDT protocol](http://stackoverflow.com/questions/27842920/send-files-after-udp-hole-punching). – gaborous Nov 02 '16 at 23:18
  • could you please share how to use ice4j pseudoTCP without server. i just want to send udp packets reliably – Rajat May 06 '17 at 11:14