Gnutella Forums  

Go Back   Gnutella Forums > Gnutella News and Gnutelliums Forums > General Gnutella / Gnutella Network Discussion
Register FAQ The Twelve Commandments Members List Calendar Arcade Find the Best VPN Today's Posts

General Gnutella / Gnutella Network Discussion For general discussion about Gnutella and the Gnutella network.
For discussion about a specific Gnutella client program, please post in one of the client forums above.


 
 
LinkBack Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #5 (permalink)  
Old August 22nd, 2001
Enthusiast
 
Join Date: July 12th, 2001
Posts: 36
HydroPhonic is flying high
Default Handling the binary data...

Quote:
Originally posted by Ahri
I got v0.4 protocal specs.
Very helpful!
Quote:
I figured out the answer to my question this morning. What happens is VB automatically takes the binary info. and converts it to ASCII text. I wanted to know how to convert it back into its original form.
VB can store the relsults of Winsock.GetData in either a BSTR or an array of integers

A BSTR is a "Basic String", preceeded by it's length (four bytes) which occupies two bytes per character on Unicode supporting systems (VB supports Unicode for purposes of interacting with ActiveX controls), so even though you think there's only one byte per character in the string, that's not the way it's stored in RAM.

Manipulating the data might be easier if you GetData it into an array of integers and interpret it seperately. VB programmers are disadvantaged by the loss of a "typecast" operator, which would allow me to take my array Incoming() As Integer and "reinterpret" its contents as though it were a Type DescriptorHeader... You must parse the elements of the array by hand, but at least it'll be easier than parsing the BSTR (as Gnutella's doesn't use ASCII descriptors like OpenNap).

Also, there's nothing saying you can't retrieve you data into one variable (say a String) and SendData an array of integers! Use whatever's least painful for you

Quote:
Also, the lengths in bytes of the incomming data does not always equal 23 + the payload length. The extra data is almost always less than 23 bytes. What's going on?
It is possible for descriptors to span TCP packets; that is, you may have to GetData again to retrieve the rest of the descriptor...

What lengths are you getting for your payloads?
Pings should always be 0, Pongs always 14, and Pushes always 26... There are NO pads between descriptors in the Gnutella data stream, so you will have to keep careful track of where one descriptor ends and the next begins. If you lose your place, it's curtains; you will be disconnected.
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem identifying Descriptor IDs Paradog General Gnutella Development Discussion 5 July 25th, 2002 03:04 PM
Payload descriptor codes Unregistered General Gnutella Development Discussion 3 May 26th, 2002 11:13 PM
Who give me a Descriptor ID? Cerebro General Gnutella Development Discussion 7 April 9th, 2002 04:38 AM


All times are GMT -7. The time now is 11:10 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 ©2011, Crawlability, Inc.

Copyright © 2020 Gnutella Forums.
All Rights Reserved.