Developers.HowItWorksSoFar

From Shareaza Wiki
Revision as of 20:09, 20 June 2009 by Kevogod (talk | contribs) (1 revision)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

How it Works So Far

Before I start on the CNeighbours column, this is a good time to write a summary of what I've found out so far.

Supporting classes CBuffer holds some memory CZLib compresses data with the zlib library

Packet classes CPacket represents a packet CG1Packet represents a Gnutella packet

Listening for new connections CHandshakes has the socket that listens for remote computers that want to connect to us

Talking to remote computers CConnection has a socket connected to a remote computer CNeighbour adds compression abilities and lots of member variables used higher CHandshake figures out what the remote computer wants by the first 7 bytes it sends us CShakeNeighbour reads and sends Gnutella handshake headers CG1Neighbour exchanges Gnutella packets with the remote computer

Inheritance trees

File:Neighbour.gif File:With.gif

Gnutella jobs

A Gnutella program has to do the following jobs:

  1. Listen for connections
  2. Make a connection to a remote computer
  3. Negotiate the handshake with the remote computer
  4. Exchange Gnutella packets through the connection
  5. Route traffic and help shape the larger network

I've found where in its code Shareaza does the first 4 tasks:

The socket in CHandshakes listens for new incoming connections (1).

Shareaza makes an object that inherits from CNeighbour and CConnection to communicate with the remote computer (2).

The code in CHandshake figures out what the remote computer wants by looking at the first 7 bytes it sends us, and the code in CShakeNeighbour object exchanges Gnutella handshake headers (3).

Then, Shareaza turns that object into a CG1Neighbour one, and starts exchanging Gnutella packets (4).

What happens next, (5), isn't something I know yet. I'm not really sure either what Shareaza does next, or what the demands of the Gnutella network require of it next. Much will be revealed by the classes of CNeighbours.