View Single Post
  #2 (permalink)  
Old May 19th, 2003
tshdos tshdos is offline
Gnutella Veteran
 
Join Date: March 24th, 2002
Location: Virginia
Posts: 101
tshdos is flying high
Default Re: Developing a simple Gnutella Servent.. Help

Quote:
Originally posted by miracle
I am trying to implement a simple gnutella servent (No PING and PONG messages.
You will be disconnected within 30 seconds from most hosts if you do not reply to a ping with a pong.

Quote:
...
Question: 1) Should the client close the connection immediately after sending the Query packets ???
No. If you close the connection you will never receive any QHs.

Quote:
What I am thinking is that the neighboring nodes(server component in the neighboring nodes) who receive the query packets would in turn connect to their neighbors and send them the query packets and close the connection. The node or nodes which have that file being searched ( i.e. a QUERY HIT) would then create a QUERYHIT packet and send it back to the upstream node from where the query packet arrived.
When they receive the query they will send it to their CONNECTED
neighbors.

Quote:
my confusion here is this:
After sending the query packet or request the client component of the first node will close all the sockets connecting to its neighbors. The results ( QUERYHITS) will be handled by the server component of the first node.
It works like this:
You connect to a neighbor and send a query, not closing the connection. The neighbor in turn, forwards the query to its neighbors and so on. Any hits generated will be routed back down the path they were sent to you. During this same time you will receive pings and queries that you will at least have to read and dispose. When you have received as many hits as you like, you MAY disconnect. Remember though, connecting is one of the most time consuming activities a servent has to do because of all the busy signals and "dead hosts".

Quote:
How does the node confirm that it has received all the QUERY HITS possible.
You can't determine that you have received all the hits possible. You just wait for some time limit and assume you have received every hit.

Quote:
A server could receive a QUERYHIT for a QUERY which was sent a long time ago.
That is why messages have the 16 bytes of message id. You store that value when you send the query and any hits resulting from that query will arrive with the same 16 bytes of message id.


If you or anyone made a client that worked in this fashion (ONLY interested in getting hits and not helping the network) would probably have their client banned. If it is just a personal project then there wouldn't really be any problem.
Reply With Quote