Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7129561
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T11:15:20+00:00 2026-05-28T11:15:20+00:00

I´m trying to do a p2p file sharing proto/software in Java. I am interested

  • 0

I´m trying to do a p2p file sharing proto/software in Java.
I am interested in learning using socket so, no I will not use JXTA or any kind of API.

I read about TCP hole punching, and it may not work on all NAT types.
But I can see that Gnutella and BitTorrent always works on every machine/NAT I try.
So do they use TCP Hole Punching to initiate a connection between hosts?

Also, a code like this would do the TCP Hole Punching?

    final ServerSocket s = new ServerSocket(7777);
    Thread t = new Thread(new Runnable(){

        public void run() {
            try
            {
                s.accept();
            }
            catch(Exception ex)
            {

            }
        }
    });

    Socket sock = new Socket();
    sock.connect(new InetSocketAddress("IP ADDRESS", 7777), 50000);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T11:15:21+00:00Added an answer on May 28, 2026 at 11:15 am

    After my research I discovered that TCP is not good for bypassing NATs and TCP Hole Punching is not a 100% sucesfull technique.

    The best way is to use UDP and implement a error tolerance layer over it so as it will work like TCP.

    Also there are some APIs like UDT for Java. But I didnt try it yet
    http://sourceforge.net/projects/udt-java/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im trying to use the fileupload control. Im using Visual Web Developer Express on
I am trying to create a very basic flash game, using Tom Krcha's P2P
Trying to import a custom UITableViewCell and it keeps giving me a file not
I'm trying to implement peer-to-peer messaging and file sharing utility within LAN, So does
I am quite new to socket programming. I was trying to make p2p communication
Trying to do this sort of thing... WHERE username LIKE '%$str%' ...but using bound
Trying to perform a single boolean NOT operation, it appears that under MS SQL
Trying to write a windows speech recognition macro. Written using XML and scripting language
Trying to figure out how to read in multiple variables through a file. for
I am trying to implement a P2P application. What I try to do is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.