Developers.Gnutella.Message

From Shareaza Wiki
Revision as of 18:20, 31 December 2007 by Dirtycat (talk | contribs) (Importing page from Tikiwiki)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Standard Message Architecture

Once a servent has connected successfully to the network, it communicates with other servents by sending and receiving Gnutella protocol messages.

In the Shareaza source code, these messages are called packets. Messages might be a better name for them, since it is easy to confuse Gnutella packets with IP packets.


message is preceded by a Message Header with the byte structure given below.

There are several different types of Gnutella packets. They all start with the same 23-byte header.


One IP packet may contain several Gnutella messages, and one Gnutella message may be split up on multiple IP-packets. This means one can never assume a Gnutella message ends when the chunk of data read from the socket ends

(find where shareaza looks for complete packets in the data stream)


Message ID: A 16-byte string (GUID) uniquely identifying the message on the network

(find how shareaza generates message id guids, where it puts them into new packets it's going to send, and where it reads and compares them to block loopbacks)


Servents SHOULD store all 1's (0xff) in byte 8 of the GUID. (Bytes are numbered 0-15, inclusive.) This serves to tag the GUID as being from a modern servent. Servents SHOULD initially store all 0's in byte 15 of the GUID. This is reserved for future use.

(does shareaza do this? find where it generates guids for packets, and how that function is different from the windows guid api)


Indicates the type of message. Gnutella servents MUST accept all the following types: Type Message 0x00 Ping 0x01 Pong 0x02 Bye 0x40 Push 0x80 Query 0x81 Query Hit

There are 7 different types of Gnutella packets.