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

  • Home
  • SEARCH
  • 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 159399
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T10:51:08+00:00 2026-05-11T10:51:08+00:00

The project I’m working on uses P2P to transfer data between peers much unlike

  • 0

The project I’m working on uses P2P to transfer data between peers much unlike Bittorrent. This component does a random scan on each interface to see what devices are on the network. So far it has been implemented as a Socket connection which checks whether it has succeeded in connecting by trying to connect to the program’s listening port. I’m wondering if it would be faster to rip this out and do a broadcast on each interface. Would this be faster/more reliable?

The current code for connection is as follows:

Socket testSock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); testSock.BeginConnect(iep, new AsyncCallback(ConnectedAsync), testSock); for (int i = 0; i <= iterations && Thread.CurrentThread.IsAlive; i++) {      if (testSock.Connected)          break;      Thread.Sleep(25);  } testSock.Close(0); 

The ‘random’ component is a simple

Random r = new Random(); 

for each interface’s subnet.

From my experience with broadcasting (Wireshark, DHCP etc) I’m under the impression that broadcasting will be truckloads faster and use heaps less resources. The reason I ask is that the person who wrote it is a smart guy and I’m wondering why he didn’t use broadcasting.

So is it worth the effort?

  • 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. 2026-05-11T10:51:08+00:00Added an answer on May 11, 2026 at 10:51 am

    Broadcasting is liable to be filtered out by certain equipment. It will be unreliable past one network segment – if what you are doing is confined to a LAN (or single network segment), then broadcasting should indeed be singificantly faster.

    That being said, random searching will never be efficient or optimal. You will likely miss nodes, have issues with the scan taking longer than expected, etc. Since you have access to the subnet mask, you should be able to calculate a list of potentially valid nodes on the segment easily enough, however again – if you are confined within a single network segment (or collection of them), then broadcasting is the way to go.

    If you are searching for a list of valid WAN nodes (ie not just one segment), then you will potentially be sending a lot of unwanted traffic. My advice there would be simply to have each node capable of sending a cache of other nodes to each other, then require a single node’s address as user-input to bootstrap onto the network.

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

Sidebar

Related Questions

The project I'm working is using n-tier architecture. Our layers are as follows: Data
A project I'm working on at the moment involves refactoring a C# Com Object
The project is ASP.NET 2.0, I have never been able to reproduce this myself,
Project Darkstar was the topic of the monthly JavaSIG meeting down at the Google
Every project invariably needs some type of reporting functionality. From a foreach loop in
My project is based on spring framework 2.5.4. And I try to add aspects
My project has both client and server components in the same solution file. I
My project is currently using a svn repository which gains several hundred new revisions
The Project's Web section (under project properties in VS2008) has a list of debuggers:
My project is split up into a typical 3 layer structure for a Silverlight

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.