Gnutella Forums  

Go Back   Gnutella Forums > Gnutella News and Gnutelliums Forums > General Gnutella Development Discussion
Register FAQ Members List Calendar Arcade Search Today's Posts Mark Forums Read

General Gnutella Development Discussion For general discussion about Gnutella development.


Welcome To Gnutella Forums

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! (click here)

If you have any problems with the registration process or your account login, please contact contact us. Your email address must be legitimate and verified before becoming a full member of the forums. Please be sure to disable any spam filters you may have for our website, so that email messages can reach you.

Once registered but before posting, members MUST READ the FORUM RULES (click here) and LimeWire/FrostWire users should include System details - help us to help you (click on blue link) in their posts if their problem relates to using the program. Whilst forum helpers are happy to help where they can, without these system details your post might be ignored. And wise to read How to create a New Thread

Thank you
Deutsch? Español? Français? Nederlands?
Hilfe in Deutsch, Ayuda en español, Aide en français, Hulp in het Nederlands

Forum Rules

Support Forums

Before you post to one of the specific Client Help and Support Conferences in Gnutella Client Forums please look through other threads and Stickies that may answer your questions. Most problems are not new. The Search function is most useful. Also the red Stickies have answers to the most commonly asked questions. (over 90 percent).
If your problem is not resolved by a search of the forums, please take the next step and post in the appropriate forum. There are many members who will be glad to help.
If you are new to the world of file sharing please do not be shy! Everyone was ‘new’ when they first started.

When posting, please include details for:
Your Operating System ....... Your version of your Gnutella Client ....... Your Internet connection (56K, Cable, DSL) ....... The exact error message, if one pops up
Any other relevant information that you think may help ....... Try to make your post descriptive, specific, and clear so members can quickly and efficiently help you
LimeWire and FrostWire users need to supply these details >>> System details - help us to help you (click on blue link)

Moderators

There are senior members on the forums who serve as Moderators. These volunteers keep the board organized and moving.
Moderators are authorized to: (in order of increasing severity)
Move posts to the correct forums. Many times, members post in the wrong forum. These off-topic posts may impede the normal operation of the forum.
Edit posts. Moderators will edit posts that are offensive or break any of the House Rules.
Delete posts. Posts that cannot be edited to comply with the House Rules will be deleted.
Restrict members. This is one of the last punishments before a member is banned. Restrictions may include placing all new posts in a moderation queue or temporarily banning the offender.
Ban members. The most severe punishment. Three or more moderators or administrators must agree to the ban for this action to occur. Banning is reserved for very severe offenses and members who, after many warnings, fail to comply with the House Rules. Banning is permanent. Bans cannot be removed by the moderators and probably won't be removed by the administration.


The Rules

1. Warez, copyright violation, or any other illegal activity may NOT be linked or expressed in any form. Topics discussing techniques for violating these laws and messages containing locations of web sites or other servers hosting illegal content will be silently removed. Multiple offenses will result in consequences.

2. Spamming and excessive advertising will not be tolerated.

3. There will be no excessive use of profanity in any forum.

4. There will be no racial, ethnic, or gender based insults, or any other personal attacks.

5. Pictures may be attached to posts and signatures if they are not sexually explicit or offensive.

6. Remember to post in the correct forum. Take your time to look at other threads and see where your post will go. If your post is placed in the wrong forum it will be moved by a moderator.

7. If you see a post in the wrong forum or in violation of the House Rules, please contact a moderator via Private Message or the "Report this post to a moderator" link at the bottom of every post. Please do not respond directly to the member - a moderator will do what is required.

8. Any impersonation of a forum member in any mode of communication is strictly prohibited and will result in banning.

9. Multiple copies of the same post will not be tolerated. Post your question, comment, or complaint only once. There is no need to express yourself more than once. Duplicate posts will be deleted with little or no warning.

10. Posts should have descriptive subjects. Vague titles such as "Help!", "Why?", and the like may not get enough attention to the contents.

11. Do not divulge anyone's personal information in the forum, not even your own. This includes e-mail addresses, IP addresses, age, house address, and any other distinguishing information. Don´t use eMail addresses in your nick.

12. Signatures may be used as long as they are not offensive or sexually explicit.

13. Failure to show that you have read the forum rules may result in forum rules breach infraction points or warnings awarded against you which may later total up to an automatic temporary or permanent ban. Supplying system details is a prerequisite in most cases, particularly with connection or installation issues.

Violation of any of these rules will bring consequences, determined on a case-by-case basis.


Thank You! Thanks for taking the time to read these forum guidelines. We hope your visit is helpful and mutually beneficial to the entire community.


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old December 23rd, 2001
Unregistered
 

Posts: n/a
Default Help On Gnutella Protocol

I am trying to make simple component that makes a connection to a Gnutella client. Right now i managed to get a "GNUTELLA OK" reply but when i send back a ping message the connection drops.
I read that i should send a ping after getting the OK from the client. Is this right? What am i doing wrong?
The component is written in Delphi with the TWsocket component.
Reply With Quote
  #2 (permalink)  
Old December 25th, 2001
Moak's Avatar
Guest
 

Join Date: September 7th, 2001
Location: Europe
Posts: 816
Moak
Default

Hmm... which test clients do you use? Did you tried to connect to your own client?
Reply With Quote
  #3 (permalink)  
Old December 25th, 2001
veniamin's Avatar
Junior Member
 

Join Date: December 17th, 2001
Posts: 24
veniamin
Default

I built a simple test program that uses this component and i try to connect to other Gnutella clients, localy on my computer, like Gnotella and Bearshare.
I succeed to send a GNUTELLA CONNECT/0.4 and also i take the right reply (GNUTELLA OK) but when i send a Ping message, i always disconnect.
Any help?
Reply With Quote
  #4 (permalink)  
Old December 25th, 2001
Moak's Avatar
Guest
 

Join Date: September 7th, 2001
Location: Europe
Posts: 816
Moak
Default

Perhaps you did send a bad package/descriptor, maybe ping with payload or a strange TTL? Try to check protocol specifications once more or take a look in existing source code.

Hope it helps, Moak
Reply With Quote
  #5 (permalink)  
Old December 25th, 2001
Moak's Avatar
Guest
 

Join Date: September 7th, 2001
Location: Europe
Posts: 816
Moak
Default

PS: GodXBlue gave me another hint on IRC. Make sure you follow the protocoll specification for connectiing and send only 'GNUTELLA CONNECT/0.4\n\n'... and NOTHING more! Each extra byte is definitely wrong here and will corrupt your data stream, e.g. any following descriptor will be corrupted.
Reply With Quote
  #6 (permalink)  
Old December 25th, 2001
veniamin's Avatar
Junior Member
 

Join Date: December 17th, 2001
Posts: 24
veniamin
Default

When i send the GNUTELLA CONNECT/0.4\n\n string it is ok because i have tested it and i take a succesful reply (GNUTELLA OK).

The structure of the Ping message that i send is exactly the same with the protocol specifications. The GUID is beeing created with the CoCreateGUID function of the Windows API and the TTL value is 5. Also the HOPs value is 0 and the data length is zero.

When i am trying to connect to Bearshare at the Hosts Screen in the status of the connection writes 'Coming' and when i connect writes 'Temp' and counts about 5 seconds and then i get a disconnect time expired message...
Reply With Quote
  #7 (permalink)  
Old December 25th, 2001
Moak's Avatar
Guest
 

Join Date: September 7th, 2001
Location: Europe
Posts: 816
Moak
Default

You automatically get a "GNUTELLA OK" after sending the two returns (\n). When you will send extra bytes after the two returns, you will shift your binary data stream and every following descriptor will be corrupted... did you understand this and checked against it? Most existing clients will drop a connection when they receive bad data. Sorry, I have no further idea.... perhaps look inside existing code or test if two of your clients will understand each other?
Reply With Quote
  #8 (permalink)  
Old December 25th, 2001
veniamin's Avatar
Junior Member
 

Join Date: December 17th, 2001
Posts: 24
veniamin
Default

hmmm... i understand...

I will see my source code again and i will inform you... Thank you..
Reply With Quote
  #9 (permalink)  
Old December 26th, 2001
Moak's Avatar
Guest
 

Join Date: September 7th, 2001
Location: Europe
Posts: 816
Moak
Default

Heyho again! Did you find the problem? *curious*
Reply With Quote
  #10 (permalink)  
Old December 28th, 2001
Ramihyn
 

Posts: n/a
Default

You may have a problem with variable alignment if you created a structure for the descriptor and fill the members of it. Ofc it depends on the type of variables you used, your compiler and it's alignment.

If you created your own structure (typedef struct {} in C), you may want to add a safety check at the initialisation code which tests for the sizeof() of the struct.
Reply With Quote
  #11 (permalink)  
Old December 28th, 2001
veniamin's Avatar
Junior Member
 

Join Date: December 17th, 2001
Posts: 24
veniamin
Default

I made more tests with my code and after reading Ramihyn's message i found this bug(?)

I declared a record for the header of each message something like:
Header = Record
ID: TGUID;
Function: Byte;
TTL:byte;
Hops:byte;
Datalength: Integer(???)
end;

in the last line i declared the data length as an Integer (it is 4 bytes) which is acceptable for the Gnutella Protocol but when i send a ping message with datalength value as zero the server got a response of 33 00 00 00h instead of 00 00 00 00h. So i declared Datalength as a DWORD (which is also 4 bytes) and the problem fixed. Maybe there are more bugs like this one...

Thak you for your help...
Reply With Quote
  #12 (permalink)  
Old December 28th, 2001
Senior Member
 

Join Date: August 9th, 2001
Location: Philadelphia, PA, USA
Posts: 369
cultiv8r
Default

Quote:
Originally posted by veniamin

Header = Record
ID: TGUID;
Function: Byte;
TTL:byte;
Hops:byte;
Datalength: Integer(???)
end;
Ah! Someone's using Delphi (or Pascal)!

Well, for that, I will give you the records used in my Cultiv8r client

Hopefully you can use them. Keep in mind that the records are packed! I'm using pointers to them, because I can easily reference them from memory that way - I read the entire message before processing.

Code:
Type
  // AKA Descriptor Header
  _PGHeader = ^_TGHeader;
  _TGHeader = packed record
    MsgID   : TGUID;
    Func    : byte;
    TTL     : byte;
    Hops    : byte;
    DataLen : integer;
  end;

  _PPong = ^_TPong;
  _TPong = packed record // 0x01
    Port      : word;
    IP        : integer;
    FileCount : dword;
    TotalSize : dword;
  end;

  // BYE packet - this is a proposal, see the GDF
  _PByeHead = ^_TByeHead;
  _TByeHead = packed record // 0x02
    Code : word;
  end;

  // Query Hit
  _PQueryResultHeader = ^_TQueryResultHeader;
  _TQueryResultHeader = packed record // 0x81
    Results : byte;
    Port    : word;
    IP      : integer;
    Speed   : integer;
  end;

  // Query Hit Result set
  _PQueryResultRecordHeader = ^_TQueryResultRecordHeader;
  _TQueryResultRecordHeader = packed record
    FileIndex : integer;
    FileSize  : integer;
  end;

  // Just the vendor ID m'am!
  _PQueryResultFooterExtensionHeader = ^_TQueryResultFooterExtensionHeader;
  _TQueryResultFooterExtensionHeader = packed record
    VendorID : array[0..3] of char;
  end;

  //  EQHD As used by many clients, ala BearShare
  _PQueryResultFooterExtensionDataOne = ^_TQueryResultFooterExtensionDataOne;
  _TQueryResultFooterExtensionDataOne = packed record
    DataLength : byte;
    Flag1,
    Flag2      : byte;
  end;

  // The GUID at the very end of the Query Hit
  _PQueryResultFooter = ^_TQueryResultFooter;
  _TQueryResultFooter = packed record
    ClientID : TGUID;
  end;

  // Push baby, Push!
  _PPush = ^_TPush;
  _TPush = packed record
    ClientID  : TGUID;
    FileIndex : integer;
    IP        : integer;
    Port      : integer;
  end;
Also, most newer clients use GUID marking. So you could use this snippet for creating your GUIDs:

Code:
function CreateGUID : TGUID;
begin
  CoCreateGUID(Result);

  Result.D4[0] := $FF;
  Result.D4[7] := $0;
end;
-- Mike
Reply With Quote
  #13 (permalink)  
Old December 29th, 2001
Morgwen's Avatar
lazy dragon - retired mod
 

Join Date: October 14th, 2001
Location: Germany
Posts: 2,929
Morgwen is on a distinguished road
Default

Hi Mike!

Nice to see you here!

Morgwen
Reply With Quote
  #14 (permalink)  
Old December 29th, 2001
veniamin's Avatar
Junior Member
 

Join Date: December 17th, 2001
Posts: 24
veniamin
Default

Thank you a lot cultiv8r... but i have them...

except the snippet for the GUID markink...

my problem is that i cant make my client to connect to another servant.
i send the GNUTELLA CONNECT/0.4, i take the right reply and then nothing...
even if i send a ping message the servant disconnects me.
Reply With Quote
  #15 (permalink)  
Old December 29th, 2001
Senior Member
 

Join Date: August 9th, 2001
Location: Philadelphia, PA, USA
Posts: 369
cultiv8r
Default

You've got to make sure that the client accepts incoming connections and connections from a local host (local loop for example).

I recommend getting Gnucleus, since this client is following the Gnutella specs quite closely. The more widely spread ones, like BearShare, have a tendency to do things their own way.

It is also very important that you send nothing more for each packet than specified in the descriptor's payload length, hence my use of packed records, etc. The TTL should be > 0 and the Hops should be set at 0.

If that fails, try outputting (like in a Tmemo object) what you and the other side have sent.

-- Mike
__________________
Okay, so I've been gone a while - but hey, meanwhile online translators have gotten better:

Ce n'est pas ma faute. Blâmer vous-même.

----

Ne me blâmez pas. Blâment votre individu.
Reply With Quote
Reply



Thread Tools
Display Modes

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

vB 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
Spin-off of Gnutella Protocol? PhreakerONE General Gnutella Development Discussion 1 June 6th, 2002 05:46 PM
gnutella protocol Unregistered General Gnutella / Gnutella Network Discussion 2 May 19th, 2002 10:23 AM
Gnutella protocol and hostcaches bateman23 General Gnutella Development Discussion 5 January 9th, 2002 03:42 AM
gnutella protocol v0.6? chuckles42 Gnucleus (Windows) 0 September 15th, 2001 08:11 AM
Gnutella protocol to sloppy? Tiago s1x General Gnutella Development Discussion 3 August 6th, 2001 04:20 PM


All times are GMT -7. The time now is 02:01 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0

Copyright © 2007 Gnutelliums LLC.
All Rights Reserved.