Re: Packets to big error

[email protected] Thu, 15 Oct 2009 16:11:17 +0000 (UTC)
Newsgroups gmane.network.gnutella.devel
Organization Home, Grenoble, France
Message-ID <[email protected]>
Quoting Daniel Cunha <[email protected]> from ml.gnutella.dev-forum:
:The handshake and the ping and pong messages are working good,
:apparently. The problem arrives when query messages are send, I receive
:from the other side a message complaining about my packet size.

Are you sure this is due to your query messages?

:I wasn't able to identify the problem during the build of query packet.
:Well, the query is send like this one:
:
:           GUID: 16 bytes with random values
:   Payload Type: 0x80
:            TTL: 5
:           HOPS: 0
: Payload Length: 9
:  Minimum Speed: 0x8000
:Search Criteria: foobar (terminated by 0x00)
:
:When packet:
:
:"k\002\000\000\260\003\000\000\334\003\000\000*\000\000\000\200\005\000\t\000\000\000\200\000foobar\000"
:(it's a ruby string)
:
:The byte size is 32.
:
:Any idea why my packets have errors?

The above serialized form looks fine, but then it's not easy to read such
a string with all the escapes.

Let's decompose the Gnutella header:

	GUID: "k\002\000\000\260\003\000\000\334\003\000\000*\000\000\000"
	Payload Type: "\200"
	TTL: "\005"
	Hops: "\000"
	Payload Length: "\t\000\000\000"
	Minimum Speed: "\200\000"
	Search Criteria: "foobar\000"

The length is properly little-endian encoded, and is correct (9 bytes).
The minimum speed is correctly encoded as big-endian.
The search criteria is correctly NUL-terminated.

I do not see any error in that packet.

:Another question, there is any protocol extension that is vital to a
:good communication?

Vendor Messages, GGEP, Query Routing, compressed connections are pretty much
mandatory items in modern servents for Gnutella communications.

Raphael