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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T17:11:34+00:00 2026-05-28T17:11:34+00:00

I should simulate a p2p protocol (using Java) in which each node initially has

  • 0

I should simulate a p2p protocol (using Java) in which each node initially has established a connection with one neighbor. Then, using a discovery algorithm, each node finds new potential neighbors and it could connect with some of these.

Suppose that two nodes of the overlay network, such as A and B, are not neighbors each other: what happens if they find themselves at the same time? A sends a connection request to B while B sends a connection request to A, so that two TCP connection are established, but one of the two would be useless…

  1. Is there a way to avoid this problem?
  2. Alternatively, if the worst were to occur this problem, how can I find it unnecessary to drop the connection?

Assuming that each node has a unique ID, it would be sufficient to associate each connection with the IDs of the two neighbors, so that the node can locate and eliminate some duplicate connections. This could be a solution, but … are there better solutions to break down any duplicate connections?

  • 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-28T17:11:36+00:00Added an answer on May 28, 2026 at 5:11 pm

    One basic solution would be to make sure that opening an outbound connection and an inbound connection are operations that cannot be executed simultaneously. You can use concurrency primitives for this.

    If these operations become sequential, then it is easy to avoid double links: keep track of all currently opened connections (inbound and outbound). Then when an inbound connection is requested, check whether there is already an outbound connection. If it is the case, refuse the new one.

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

Sidebar

Related Questions

I'm writing a Java applet where I should be able to simulate a connection
My application have several modules, each in one tab on the mainform. When using
Should the folders in a solution match the namespace? In one of my teams
Should I still be using tables anyway? The table code I'd be replacing is:
Should developers avoid using continue in C# or its equivalent in other languages to
Should libraries that the application relies on be stored in source control? One part
I am trying to simulate a session using FactoryGirl / shoulda (it worked with
I have a series of UIImages with which I need to simulate depth. I
I would like to build a simulation engine which can simulate a soccer (association
I want to simulate MyApp that imports a module (ResourceX) which requires a resource

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.