1

For a file sharing application I would like to use TCP/IP Sockets. But this doesn't work because both clients are behind NATs. Therefore I have to use UDP and the hole punching method.

Since UDP is not reliable, I have to implement a TCP-like protocol. I don't need streams. A message based protocol would be ok. Is there already a free Java library somewhere? If not, is there an abstract tutorial, how to implement such a protocol?

1
  • That (TCP over UDP) is what OpenVPN does. I do not know if there is any java implementation, but the protocol should be easily available (do not know if it is difficult to implement). Commented Jun 30, 2011 at 10:06

3 Answers 3

1

You Can Implement TCP hole Punching that will allow two peer to communicate behind fire wall. first go through this link
http://www.brynosaurus.com/pub/net/p2pnat/

and then update the question if need further help on this.But the problem with TCP hole punching is that it can be successful in 60% of router available in the market whereas UDP hole punching is 80-90% successful.

check out this link as well.http://stackoverflow.com/questions/917385/nat-traversal-with-java

Sign up to request clarification or add additional context in comments.

Comments

1

If you search for a UDP-based message-oriented protocol, I'd consider TeleHash. There are also Java libraries available.

Maybe it's the wrong choice if you rely on high volumes of binary data to be transmitted, but then a stream-based protocol might be the better choice anyway.

Comments

0

was it helpful?

http://www.syslog4j.org/

1 Comment

Not realy. Have looked into the UDPNetSyslog class. But it simply sends the message with UDP. But does not have any TCP. If the message gets lost on the way, nobody would note this. Have I looked into the wrong class?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.