tags:

views:

697

answers:

9

Are there any known methods of finding peers without using a dedicated central server?

ie: If I have peers which are disconnecting and reconnecting to the internet but getting a new IP address each time, and I want to connect to them without setting up a dedicated server to register with.

I was thinking about using peers email address to send a manifest of connected peers periodically, with some sort of timecode, negating the need for a dedicated server. This would be a fallback if none of the peers could be connected to after trying all the previously known peer addresses. But existing models of finding peers would be preferable.

EDIT: So far everyone seems to agree that a central server would be needed whilst dealing with the internet as opposed to a private network, which I thought might be the case. The idea of using email addresses provided by say Google or Yahoo instead of providing my own server seems pretty robust.

+1  A: 

Three ways, off the top of my head, though you're always going to need some central server to start the connection unless you went with option 3.

  • Central server that maintains known list of peers, with keep-alive.
  • One or more central servers that maintain some common resource peers can use to discover one another, but once connected no longer need the central server as long as the peer remains connected (something like BitTorrent); can chain peered connections as well.
  • Port/IP scanning (strongly not recommended).

In your example, you'd still have some kind of central server where the peers would be registered; the protocol is the only difference.

GalacticCowboy
+2  A: 

In the limited case of peers within an intranet, it is possible to send a broadcast UDP message to a known port asking for peers to report back.

Oddthinking
+1  A: 

Your method of sending email does use a dedicated server, though; the peer's email server, to be precise.

Roughly, I don't think it's possible without using some sort of dedicated storage or server (which the email approach does, albeit obliquely) UNLESS you are able to characterize the connectivity to the internet that your peers are using.

Basically, if you have a set of X number of peers, that connect for Y amount of time, and they are then off the grid for Z amount of time... essentially, you can construct a probability equation about how likely it is that the set of peers that you last contacted is still available; where that probability approaches 1 (for a given set of X, Y, and Z above), you can most likely sustain a peer-to-peer network without using storage.

Possibly more in the spirit; instead of having a "dedicated central server", use simple online free service to specify a peer list. Set up a yahoo group, or something like that; clients can automatically look it up and get a peer address from which to query a set of peers; the client can be coded with the authentication to post to the group, and can post periodically its IP address so that others can request the set of known active peers.

If you want to get really tricky, you can start using basically steganographic methods to hide peer location information. I.e. get a google search for "blah"; find the first site listed in the results that has an unprotected (no CAPTCHA) message board; find the third (or whatever) post that starts with "Indubitably" (or whatever), and find the header of the first message there, and there's the IP address of a peer. If that doesn't work, go down the list of search terms to the next one.

But that's sneaky. :-)

McWafflestix
@McWafflesitx: I'm a pedant though, my use of dedicated server mean't not providing a server dedicated to the purpose of joining peers. Utilising webservices or existing servers in a different way seems to fit the bill.
_ande_turner_
+1  A: 

Could you re-use an existing dedicated server for the purpose?

I am thinking in particular of registering each of the peers with a Dynamic DNS, but if you were willing to get a bit uglier, sharing access to a known Hotmail account or Google Doc or the like.

Oddthinking
@Oddthinking: :) The more I use SO the more I appreciate I can be way unclear at times. lol My thought was when my computer connected, it emailed its IP address to a list of peers, and then the peers just check their users mail for a manifest of another peers IP.
_ande_turner_
The trick is if you can connect to one peer from an old list of IP addresses, you wouldn't even bother with the email process, because a single peer could provide you with a peer list. Emails would be a fall back if no peers could be found.
_ande_turner_
+1  A: 

To put it simply no, there is no way to do this without a central sever.

If you want to do this you simply need one or more central servers, whether by dynamic dns or not. The clients need a method to discover where they should connect to, and the only truly sensible way to do this is with your own server, in the simplest scenario it only needs to send an IP address in response.

Virtual severs can be had for around $15/month, which IMO is considerably cheaper than trying to use or abuse someone else's bandwidth.


[Edit].

To put it simply, there is another way, as follows.

Upon reflection I think what I'd do is to designate a set of peers as cluster controllers and use a dynamic DNS service to allow other peers to discover the cluster controllers.

Choose a dynamic DNS provider I'll call it myc.ath.cx (I Use http://www.dyndns.com/).

Each peer has to be capable of becoming a cluster controller. A cluster controller will contain a list of all the other peers connected.

When a peer is started it looks up myc.ath.cx and attempts to connect. If connection cannot be made within a period, say 30 seconds, it takes over the registration of the DNS entry.

Any peer wishing to discover other peers can simply query myc.ath.cx and a list will be provided

All peers are responsible for periodically downloading the list of peers, in case they need to cluster controller.

The cluster controller will periodically query the DNS entry - if has changed from it's IP address then it knows that it is no longer the cluster controller - so it will contact the cluster controller that currently has the DNS entry and provide it's list of known hosts.

The cluster controller will periodically contact hosts on the list to ensure that they are still valid.

Richard Harrison
Fair comment - however I think I've had a better idea.
Richard Harrison
+2  A: 

There's no way around having to know at least one initial peer to discover more. Fully P2P protocols, such as Gnutella or Gnutella2, or the simpler Overnet (made famous by Storm Worm), are based on each client having a start-up list of a few peers. These can come off a web-based automated tracker for example. The client will discover the whole network or portions of it by asking other peers for more addresses, for example when delegating a file search.

If you truly can't have any kind of a centralized resource, the best you can do is find the first peer through broadcasted messages and ultimately IP address scanning. The first approach is well-meaning but in at least 98% of cases won't yield any results. The later approach, of course, is abusing the internet, as well as illegal in most countries.

I really would rethink having some kind of a central tracker. It can be something as simple as a PHP script on a webserver (the gnutella network, today, is held up by ten-twenty such scripts, hosted by people who don't even know each other). And this sure is more lightweight than email (which, due to spam filters at the very least, would not work anyway).

psoul
+2  A: 

You can either use a central directory or some sort of broadcast protocol for service discovery. Assuming that you could get them indexed by Google, you could conceive of a system whereby each peer runs a web site with some unique, rare words contained on a specific page. You could then use Google search results based on these words to identify potential peers. This would essentially be a (noisy and slow) internet broadcast.

If the page structure was a well known pattern or contained identifiable connection information for that peer, it would be easy to distinguish them in the search results. Using such a public directory leaves you open to compromised nodes in the network that is formed, but this is pretty much true of any P2P network absent some security mechanism.

Getting the web sites crawled and highly ranked by Google (or some other search engine) would be the trick. I can think of a couple of ways, but they aren't ones that I would use. For a legitimate service, I'd rather spend the money or find a free web site that could function as a directory.

tvanfosson
+1  A: 

This is a typical use of a distributed hash table algorithm. I'd suggest looking at something like pastry. It uses a overlay network (Application layer network) on top of other layers.

Each node has a GUID which is used to route requests across the peer network.

steve
A: 

If you're loooking for an already established central server then see the metaserver entry on page here:
http://martindevans.appspot.com/
You can register peers on there and then other peers can find them. Obviously this is a central server, but it requires no maintenance on your part.

Martin
@Martin: Can you check your link? According to Firefox, "The site is redirecting the request in a way that will never complete." Thanks.
Bill the Lizard
done.If you do plan to use the metaserver I have a little .NET library built if you're interested (and using .net)
Martin