|
|
|||||
|
|
|||||
|
|||||
|
|
GnucDNA and Delphi Have you ever wanted to implement your own Gnutella client? Gnutella and P2P file sharing is becoming an increasingly popular and, depending on the intended purpose of sharing, an important part of modern development. In the past couple of years several major Gnutella clients have been released as open source, such as giFT, Shareaza, Gnucleus and Limewire, the problem for Delphi developers however is that these clients are all in either the C++ or Java development languages. Enter GnucDNA. GnucDNA is an open source COM interface for the Gnutella network. Originally developed for Gnucleus, GnucDNA was separated from the user interface components of Gnucleus to enable third party vendors to take advantage of the Gnutella network in their own applications. For us as Delphi developers this means immediate access to the Gnutella network; all we have to do is provide the user interface. More information on Gnucleus and GnucDNA can be found here. The GnucDnaIntf Library So if GnucDNA exists as an easily accessible COM library, why create an interface for it? Well, realistically there is no need to create an interface for this library, everything is there and is ready to be called. In practice, however, the first thing you will notice as a Delphi developer is that only one interface exists for a particular area of functionality; for example the ISearch interface (i.e., the interface used to conduct a search of the Gnutella network). This one interface is used to start and stop searches, provide the event callback mechanics for search results, identifies each result for all results of all searches as a number, and provides the list of all hosts identified within a result as another number. Not a bad thing, just messy... Because Delphi promotes intelligent use of lists, the "logical" step for implementing this interface as a native class would be to separate the search engine, queries and results into their own classes and this is the direction that GnucDnaIntf has taken. This means there is a search engine which has a number of child objects identifying current queries, each of which contain their own child objects identifying a particular result for the each query object. Known Issues In developing EvoScape D2D there were several small issues an inconsistencies which I discovered in the GnucDNA interface. For example when updating some of the core preferences of GnucDNA, the hosts list is refreshed internally without a notification being generated for your application. Whilst this is more of a nuisance than a detrimental issue, the workaround is relatively simple - your application (or the user using your application) will be the only entity that will change the preferences so you can identify when the preferences are changed so that you can update your interface accordingly. Likewise there are several IPref methods which have not been defined in the TGnucDnaPreferences class - at this point in time EvoScape D2D does not use those extra preferences and as such I neglected to include them during initial development. This being said, implementing them yourself is relatively simple. GnucDNA also implements an IChat interface, for conversation between GnucDNA clients. This particular interface has not been included in GnucDnaIntf. Unfortunately I didn't document all of the known issues as I wrote the GnucDnaIntf interface, so they won't all be documented here. But if it seems as though small pieces are missing here and there, more than likely the reason is as explained above. Where to start? All roads start from the TGnucDNA interface, created using the CreateGnucDna method of GnucDnaIntf.pas. Requirements Download GnucDnaDelphi.zip can be downloaded here.
|
||||
|
Microsoft Internet Explorer is a registered
trademark of Microsoft Corporation. | |||||