Click here to Skip to main content
13,250,043 members (65,287 online)
Click here to Skip to main content
Add your own
alternative version

Stats

64.7K views
23 bookmarked
Posted 26 Jul 2002

Gnucleus Tutorial (Part 1)

, 26 Jul 2002
Rate this:
Please Sign up or sign in to vote.
Tutorial of Evolve Dialog of Gnucleus - Gnutella Client.

(Image 1)

(Image 2)

(Image 3)

Introduction to an open source Gnutella client - Gnucleus

Gnucleus project is one of an open source Gnutella clients, in which NullSoft had originally created a P2P (peer-to-peer) application. However, AOL - the parent company of NullSoft, ordered NullSoft to shut down this project. In spite of this situation, many clones of Gnutella have been created, and many Gnutella client projects provide us the free source code.

Especially, Gnucleus is developed in Visual C++ and uses CAsyncSocket class in MFC very well. I have downloaded Gnucleus 1.7.4.0 source code, but I haven't read these codes in detail that time. After I installed WinCVS, and updated to the latest Gnucleus 1.8.4.0 source code, I had my mind to share these source codes with other people interested in P2P applications as well as CAsyncSocket.

Since Gnucleus is a huge project, I will not provide all tutorials to Gnuclues at one time. However, I found that Evolve dialog is the better and simpler example of how to use HTTP GET command and CAsyncSocket class.

How Evolve Dialog works?

Evolve is the process to update the latest Gnucleus.exe file and the other files when we open Gunclues. Each Gnuclues has its own version number in the source code. update.xml includes the information of which files should be downloaded and updated. In order for Evolve process to work as a stand alone dialog application, I made some Doc, View derived classes and the other classes object line disabled. I want to keep source code as original as possible.

CInternetSession GnucleusNet gets the information of which versions and files should be updated. CGnuEvolve* m_Download actually posts HTTP GET command to the webserver to download each updated file.

  1. Choose which host is used to update the files? (Image 1)

    Originally, Evolve dialog of Gnucleus doesn't have this message box, but I need this to make some tests for update.xml file at the local web server. This time, I don't want to distribute the files needed, so if you choose NO of this message box, you will get some error message. You can download the necessary files from here.

    After you get the necessary files, you create update folder at the top directory of your local web server. And try to type http://localhost/update. If you view this directory as Gnucleus web server has, the local web server choice of this message box should work.

    I just show the directory and files needed for the localhost to work.

    /update/update.xml
    /update/Gnucleus_1.8.4.0/Gnucleus.exe
    /update/Gnucleus_1.8.4.0/GnuBlocked.net
    /update/Gnucleus_1.8.4.0/ChangeLog.htm
    /update/Gnucleus_1.7.5.0/WebCache.net
  2. Evolve Dialog detects the latest four files updated. (Image 2)

    If we click Evolve button or wait about 15 seconds, Evolve dialog downloads the necessary files by HTTP GET command from the web server. CGunEvolve objects keep the buffer from the downloaded files, and CFile object adds these buffers to the files. Image 3 ListBox shows some process of what kinds of GET command are send to the webserver and how CAsyncSocket functions like OnConnect, OnSend, OnReceive, Send, and Receive are called.

    This is an example of how these functions are called:

    TRANSFER_CONNECTING
    Creating Socket is success
    Connecting to localhost is success.
    Send is called.
    TRANSFER_CONNECTED
    GET /update/Gnucleus_1.8.4.0/GnuBlocked.net HTTP/1.1
    User-Agent: Mozilla/4.0
    Host: localhost:80
    Connection: Keep-Alive 
    
    OnSend is called
    TRANSFER_RECEIVING
    ReadFile is called.
    m_File.Write is called.
    GnuBlocked.net Gnucleus_1.8.4.0/GnuBlocked.net Evolve
    GnuBlocked.net Gnucleus_1.8.4.0/GnuBlocked.net Evolve
    TRANSFER_CLOSED
    Close() is called
    OnRecieve is called.
    TRANSFER_CONNECTING
    TRANSFER_CLOSED
    Close() is called

    Last, this time, I didn't explain the code in detail partly because these codes come from Guncleus gurus. I appreciate for Gnucleus gurus for this free source code.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Masaaki Onishi
Software Developer (Senior)
Japan Japan
Visual C++ developer & Master of Business Administration (MBA) holder.
My interests moves from MFC to C#, especially ASP.NET, Web Service and Mobile Development.

I have lived in Atlanta, GA of USA from 1995.
As my name shows, I'm a Japanese.
This is my name in Japanese.
大西 正明

I have moved to NJ to work for the project to rebuild GUI (MFC) of some big Japanese electrioc company product. Sometimes, I enjoyed to walk around NYC. Smile | :)

(April 09, 2006 updated)
I have come back to Japan from August, 2004. Currently, I live in Tokyo in Japan, and work as a contract software engineer in the Japanese major securities company. The languages of the project are VC++(MFC) and VB.

You may also be interested in...

Comments and Discussions

 
Questionupdate.xml file example left out. Pin
Ed Hardin20-May-17 7:09
memberEd Hardin20-May-17 7:09 
GeneralGnucleus in C# Pin
Russel Harvey5-Nov-02 19:01
memberRussel Harvey5-Nov-02 19:01 
QuestionGnucleus web site seems to be down now? Pin
Masaaki Onishi28-Jul-02 7:06
memberMasaaki Onishi28-Jul-02 7:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.171114.1 | Last Updated 27 Jul 2002
Article Copyright 2002 by Masaaki Onishi
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid