jMule Develloper documentation

 
author : I forget, a french fan of emule

Introduction edonkey protocol

 
 

The eDonkey/eMule protocol - How does it work? (newbie explainations)

eDonkey2000 is a programme file sharing between private individuals. It thus makes it possible to transfer from the files of a private individual towards another. For that, it uses an architecture based on clients and servers. Only the client receives or emits files; the server have for single role to connect the clients so that they can exchange files.

The eDonkey2000 client is the program eDonkey2000 which you use. Each user indicates repertories that he would shares. Then, these files are placed at the disposal of all. Therefore they could be downloaded by other clients eDonkey2000.

 

This diagram shows the exchanges of files between the eDonkey2000 client. Each file are divide in chunks of 9 Mo. These chunks are exchanged between the clients, even if the client who emits a part of file does not have the complete file. In this way, the files are diffused more quickly since a client does not need to wait to have the complete file to be able to transfer the part of the file which it has with another client.

This point shows also a problem : how to make so that the client find other client, to send or get their files, through all computers of Internet network? It is that the server intervene: each client must be connected to a server and each client is connected to several eDonkey clients. Each client references files of each client who is connected to him.

Each client, to find another client who can send the file to him that it seeks, will call upon the server. The server communicates then to the client who makes the request of it, at which client it will find the file which it seeks. This allows the client who obtained this response of the server to contact the client to indicate by the server, and to require of him to send the file to him which interests it. In this way, the clients can be on Internet network and exchange their files.

A client is not limited to the exchange files with clients connected to server which it is him even connected : each client can get files on a client connected to another server. For that, the client eDonkey2000 contact all servers contained in his server list for their asking, as it does it for the server to which it is connected, co-ordinates of other clients able to provide him the files that it seeks.

It is included/understood thus that your client will be able to find another client being able to transfer the file to him which it seeks only if the server which this client is connected is in your list of server. It is thus very significant to have a good list of server. Besides Edonkey2000 has a means of maintaining this list of servers.
It proceeds as follows: each server, when it start, sendings these co-ordinates with the servers which it knows, and gets lists of the known servers of these servers.
Each server has a server list, and this list will be transmitted to each client when he connects himself to its. In this way, the co-ordinates of the servers can change without that preventing the clients eDonkey from using these servers.

Exchanges

The clients and the servers eDonkey2000 have names, but these names are not used for eDonkey operations (for this reason they are not necessarily single). eDonkey2000 directly uses as coordinated client's IP address and the server's URI ( IP adress and port number) .

Here short and largely incomplete description of the operation of the exchanges on the network, in order to what everyone can include/understand the continuation :

All the communications on Internet use addresses IP and ports (URI adress). Each computer connected to Internet has a single address IP which makes it possible to forward data to him; like in real life when you send a letter, you have posted an adress on it. A program, when it transmits data on Internet network towards another computer, indicates the URI of the destination. URI contains a port number, which allows to determine which program are intended the data which arrives on a computer. This makes it possible to make function in same time several program using the network on the same computer. When you open a Web page for example, your Internet navigator contact the computer containing this page by specifying in given sent that the wearing destination is port 80. It him sending also the number of a port on which it will be necessary to answer (for example, the 1674). This number of port is allotted by the operating system, and can vary between 1024 and 65536. The fact is port number is used to determine type of communciation between 2 computers : HTTP, FTP, POP, SMTP, etc.
IP adress is used by two network protocols : UDP and TCP. A network protocol determine the way to etablish communcation through a network.The main differencee between thus is that TCP establish a connection and UDP not. In fact a communciation without connections haven't any error handler. Therofore, some data could be lost before they reach their destination and the sender will never noticed that his informations never arrived. But UDP uses less bandwidth and is faster.

Connection to the server

Each server uses a port defined by the administrator. By default, it is the port number 4661. When a client connects himself to a server, it established a connection towards server TCP 4661. Then the server opens a new TCP connection on 4662 port (per default), in order to verify if this connection is possible. It closes this TCP conection just after it was established, and does not use it any more. Then, the server replied on opened connection (the first) : it send its server list.

Ask for sources

To find clients who have wanted files, it regularly contact all the servers of its list. These requests for sources are made by using connection TCP 4661(not always) initiated by the client if the client request to the server which it is connected, and in UDP 4665 with the other servers (on serverlist). eDonkey is be able to transferer the same file from lots of differents clients, (who have a part that it doesn't have but It could keep the "unneedeed source"). So it asks on UDP 4672 to known clients.

Search for files

In the client, it possibles to seek a file thanks to its name, by questioning the server on which one is connected. Research is done by using connection TCP 4661 initiated by the client. "Extend search" makes it possible to make research on the other servers. Research is done then in UDP 4665.

Transfers of data between clients

When a client obtains sources, it connects himself to this other client in TCP on port 4662. Each client is put in the waiting list of the other. The transfers could then be done as well towards a client towards the other.

The exchanges between servers are limited to the transmission of their server list on UDP port 4665.

ID

Each user have an ID. It is a number which corresponds at your address IP modified, or, if the number is very small, with a number of weak ID on the server. So that the exchanges can be done between clients, it is necessary that the clients can connect themselves between them in TCP 4662. For this reason the server checks that connection is possible with the client in TCP 4662.

If connection is possible, the waiter give a strong ID to the client (the ID corresponds then to address IP modified).

If connection is not possible, the waiter give a weak ID. In this case the number is much smaller and is allotted as follows: the server numerote the client with weak ID while starting to 1. It increases this number with each new client with weak ID. If you obtain a ID of 235 for example, it is that you are the 235ème client with weak ID on the waiter.

If your client has a weak ID, the other clients can not connect to your client in direct way. They have to demand server your client is connected to if possible per TCP to port 4661 else per UDP to port 4665 , to demand your client to open a connection to them. The server sends this demand over the TCP connection to 4661 from your client to open a TCP connection to the demanding client (on port 4662). This means more traffic for the server by weak ID clients in an indirect way than for strong ID clients. Another problem for weak ID clients is that they can not connect to each other.

 
Licensed under the terms of GNU GP License Valid HTML 4.01!