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 7722193
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T04:06:31+00:00 2026-06-01T04:06:31+00:00

For my course, we have to build a bittorrent client in Java. I’m having

  • 0

For my course, we have to build a bittorrent client in Java. I’m having a tough time conceptualizing how connections are dealt with. I’m going to go step-by-step and point out the part that’s bothering me. If I make an incorrect statement please correct me but for the most part I understand the protocol, it’s more of an issue with connections from incoming peers and dealing with ports and sockets.

So when you connect with the tracker, you tell it the port you will be listening to, for peers wanting to connect with you.

The peer dictionary you get from the tracker includes all those peers ports they are listening on. To connect with those peers, you just create a socket on a random port and then transmit the handshake.

Now my question is, is if you’re the peer on the other side. That is, if you’re listening on the port you gave the tracker and a peer sends you a handshake on that port how do you communicate to the peer that you want it to transmit to a different port.

I’ve gotten very confused with ports and sockets trying to figure out how to deal with downloading from more than one peer and uploading as well but here are some assumptions I’ve made:

  1. For every peer you connect with you use a new port/socket which you upload(if they’re an active peer)/download with.
  2. The port given to the tracker is used only for listening to incoming peers.

I think maybe my understanding of ports and sockets maybe flawed which is what’s keeping me from grasping the problem. I hope I worded this correctly too. Thanks.

  • 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-06-01T04:06:32+00:00Added an answer on June 1, 2026 at 4:06 am

    While your server listens on a specific port for incoming connections, the underlying protocol will switch to a new port as part of the handshake. You don’t have to tell the peer to use a different port.

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

Sidebar

Related Questions

I'm having a difficult time understanding how to do this. I have two models,
I'm going to have to build a custom control for a WinForms application. But
I have a java application build upon Spring 3. This project has another jar
I have configured a Maven build for a very small GWT project I'm having.
Im new to programming, in our c++ course, we have to build a stack
I'm in a computer systems course and have been struggling , in part, with
I have a course object. The course object has a set of tutorials and
i have a course project to do on network security, the project theme is
Of course most languages have library functions for this, but suppose I want to
I have to write a mashup application for an university course and I have

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.