Translated from Yoram kulbak and Danny Bickson the eMule Protocol Specification
Translation: lzcx
QQ: 402722857
Email: lzcx_cn@yahoo.com.cn
For learning. For more information, see the source.
3
Client Server
UDP
CommunicationEMule clients and servers use unreliable UDP services to maintain connections and enhance search. The total number of UDP packets generated by the eMule client can reach 5%-
These are determined by the number of servers in the client server list, the number of sources of each file in the client download list, and the number of searches executed by the user. A UDP packet is triggered by a timer. The timer expires every Ms. A separate thread is responsible for sending UDP delivery results at the maximum rate of 10 UDP packets per second.
3.1
Server connection and status informationThe client periodically verifies the server status in its server list. Verification is completed by sending a UDP server status request (see section 6.3.3) and a UDP server description request (see section 6.3.7. The simple keep connection plan described here generates a maximum of packages per hour. In any case, the maximum packet rate is 0.2 packets per second (or one packet per five seconds ). When checking the server status, the client first sends a server status request message, and then sends a server description request every two attempts (sending a server status request, see the figure 3.1. The server status request sent by the client contains a random number and is returned in the server response. When the number returned by the server is different from the number requested by the client, the response information is discarded. Each time the packet sent to the server is a status request, the client moves the attempt counter. Any messages (including search results) from the server reset the attempt counter. When the counter reaches a configurable limit, the server considers it as a dead host and deletes it from the server list of the client. Server response includes several data items: Server Status response (see 6.3.4) includes the number of current users and files on the server, as well as the software and hardware limits on the server (see section 1.7 ). The server description response (see section 6.3.8) contains the server name and a short description string. Figure 3.2 demonstrates the full connection sequence of message streams between the client and the active server.
3.2
Enhanced file searchThe eMule client can use UDP to enhance its file search. The format of UDP search results is almost the same as that of question mark ?? Section describes the same TCP search request. The server only responds with search results. There are two different opcdes for UDP search result messages, and I cannot clarify the differences between them. The UDP search package is sent to the server in the client server list. For more information, see Section 6.3.5 and Section 6.3.6.
3.3
Enhanced file source searchWhen the number of sources of a specific file in the client download list is less than the configured limit (100, the client periodically sends the UDP packet to its server list to find more sources for the file. A packet may be sent per second, making the source search a considerable part in the UDP Transport produced by the client. The message format (described in Section 6.3.1) is very similar to its TCP counters. Note: In contrast to TCP source searches, UDP source searches weaken in file searches. For a specified file, only the number of sources owned by the client is used.
Trackback:
Http://tb.blog.csdn.net/TrackBack.aspx? Postid = 604633