Witek
Witek

Reputation: 6472

TCP implementation in Java using UDP (Datagrams)

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?

Upvotes: 1

Views: 3001

Answers (3)

Vikram Ranabhatt
Vikram Ranabhatt

Reputation: 7630

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

Upvotes: 1

b_erb
b_erb

Reputation: 21261

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.

Upvotes: 1

Rupok
Rupok

Reputation: 2082

was it helpful?

http://www.syslog4j.org/

Upvotes: 0

Related Questions