Hello all i like to understand the concept of networking that programs like soulseek or emule or bittornet are using , i don't want to know all the architecture of curse but just how can one client see other clients in the network without knowing the exact ip to connect
For BitTorrent, there is actually a starting point for a client. In the torrent file, is an IP address and port of the tracker for that torrent. In some torrent files, there are multiple trackers.
Once a connection to the tracker has been established, it will obtain a list of other clients (IP and port), for the particular torrent, so that it can connect to them. It will also register its IP and listening port, for the particular torrent, so that other clients can connect to it.
Once a connection to another client has been established, it can also use peer exchange to obtain a list of other clients (IP and port) so that it can further find more clients for the particular torrent.
Also, independent of the torrent file, for certain BitTorrent clients, the peers will work together to form a Distributed Hash Table (DHT). They will work with many peers in a redundant fashion, to keep track of each other. They also use some sort of fixed information to establish its place in this DHT.
They may have used the torrent files to find peers for this DHT, but they will keep this DHT setup, even after they finished with the torrent. A DHT is not dependent on the torrent -- a client will join one DHT, no matter how many torrents it is using. When a client exits and restarts, it will be able to reestablish into the DHT, provided that some of the peers from the long list of known peers are still around.
A DHT, unlike with a tracker, has no centralized point of failure. A clients ability to restablish with a DHT is purely dependent on the known peers. Obviously, if this list was long, or the last connection was not too long ago, it should have no problems establishing with the DHT again.
So what happens when you try to use a torrent when the tracker is down? Since the tracker is down, there is no starting point. Hopefully, the client will be able to establish itself into the DHT. With the DHT, it can find the peers for a particular torrent based on keys in the torrent file. It can also register itself for the torrent, in the DHT, just like with a tracker.
Henry [ September 16, 2007: Message edited by: Henry Wong ]
In general, clients can't talk to clients. They talk to Servers. The clever part of BitTorrent is that it doesn't require a fixed server. It can hand off from servers, using the Tracker as the directory, until the peers pick up and find each other.
So while you don't send the data to a server, you need something to act as the directory, "In the torrent file, is an IP address and port of the tracker for that torrent. "
All distributed systems need something to get bootstrapped. The details of how you find something to talk to vary with implementations. With simple Java RMI, you know where the remote is. With Corba, you can use a directory service to find who you can talk to, but then you still have to find the directory service.
Doing this properly, with security, and generally is a bit of an engineering challenge.
subject: General Network Question about finding client's in network