Next: Metadata and rich queries
Up: Gnutella
Previous: Ultrapeers and routing
  Contents
  Index
Transferring files
Upon receiving a QueryHit message a servent may initiate a
HTTP connection with the host holding the file. The
GET command issued by the servent contains the
index of
the requested file, as specified in the result set of the
QueryHit message. Following the index is the name of the file.
Next follows a small example.
Assume that a QueryHit message contained at least the entry shown
in table tbl:examplequeryhitresult.
Table 3.10:
Example of a QueryHit result
| Index |
Size |
Name |
| 1342 |
78835 |
gnutella_0.6_draft.txt |
|
A download request for the file gnutella_0.6_draft.txt
would be initiated as follows:
GET /get/1342/gnutella_0.6_draft.txt HTTP/1.1\r\n
User-Agent: Gnutella\r\n
Host: 123.456.789.012:6346\r\n
Connection: Keep-Alive\r\n
Range: bytes=0-\r\n
\r\n
The servent receiving this request responds with HTTP
compliant headers such as:
HTTP/1.1 200 OK\r\n
Server: Gnutella\r\n
Content-type: text/plain\r\n
Content-length: 78835\r\n
\r\n
The Range header can be used to request a file segment, if
this header contains a range other than the whole file. This allows a
Gnutella client to download different parts of the same file from
different hosts, which can reduce the download time substantially. This
technique is called swarm downloading. If a segment is
requested the HTTP response headers could look as follows:
HTTP/1.1 206 Partial Content\r\n
Server: Gnutella\r\n
Content-Type: text/plain\r\n
Content-Length: 24761\r\n
Content-Range: bytes 32104-56864/78835\r\n
\r\n
Next: Metadata and rich queries
Up: Gnutella
Previous: Ultrapeers and routing
  Contents
  Index
Marcus Bergner
2003-06-10