HubBOT.NET Project

Technical discussion about the NMDC and <a href="http://dcpp.net/ADC.html">ADC</A> protocol. The NMDC protocol is documented in the <a href="http://dcpp.net/wiki/">Wiki</a>, so feel free to refer to it.

Moderator: Moderators

Locked
djechelon
Posts: 8
Joined: 2004-10-29 11:44

HubBOT.NET Project

Post by djechelon » 2005-01-08 20:57

Hello,
I am a PublicHubList owner. My list is based on other lists' data, and I noticed many hubowners are faking the usercount on the main Hublists like Dreamland.

I wrote a topic about "spidering" hubs. Now I have begun to code a VB.NET program that connects to hubs in PublicList, counts the users (and maybe the sharesize too) and leaves the hub.
I've managed to connect and retrieve hub name and description. Now I need to get user list.

The program logs into the hub with fake :-( sharesize and tag correctly. But, when managing sockets, I need to get the HUGE stream of the userlist (I am testing it on a 1000 people hub), the socket stream is cut. Also, when placing all socket data into a logfile, there are many and many white spaces.

This is the code of my ReadSocket function

Code: Select all

    Private Function LeggiSocket(ByRef Hubsock As TcpClient) As String

        While Not Hubsock.GetStream.DataAvailable()
            Application.DoEvents()
        End While
        If Hubsock.GetStream.DataAvailable() Then
            Dim InBuffer(Hubsock.ReceiveBufferSize) As Byte
            Hubsock.GetStream().Read(InBuffer, 0, Hubsock.ReceiveBufferSize)
            Return System.Text.Encoding.Default.GetString(InBuffer).Trim()
        Else
            Return "No dati"
            Exit Function
        End If
    End Function


In this example, the socket is already open and the function simply returns a text string. I need the Byte variable to be automatically sized matching the socket stream's length.

Any help? How does DC++ (in C++ language of course) get the userlist via socket stream? I'm new to C++, but if anybody tell me the exact position of the code with some explanation I can simply port the code to my application.

Thank you for your help.
DJ ECHELON

MASTER OF BIT TORRENT

WEBMASTER http://www.p2pmania.it
My FAST PublicHubList http://www.p2pmania.it/hublists/PublicH ... config.bz2

PseudonympH
Forum Moderator
Posts: 366
Joined: 2004-03-06 02:46

Re: HubBOT.NET Project

Post by PseudonympH » 2005-01-08 21:58

djechelon wrote:a VB.NET program

I think that might be your first problem.

Anyway, NmdcHub.cpp/h might be a good place to start looking.

djechelon
Posts: 8
Joined: 2004-10-29 11:44

Post by djechelon » 2005-01-09 08:24

By the way I have another problem.
When completing the Hub querying i use

Code: Select all

Hubsock.Close()


But i noticed that the BOT is still inside the hub. When I close the entire application the BOT disconnects from the hub.

Anyway about Nmdc.cpp, it's too difficult for me (I'm learning VB.net because it's easier to read and because Visual Studio automatically shows available Properties & Methods, and even warns you about many errors before compiling).
Anyway, from what I understood from that file, the data socket reading is left to the socket object itself. Any more ideas?
DJ ECHELON

MASTER OF BIT TORRENT

WEBMASTER http://www.p2pmania.it
My FAST PublicHubList http://www.p2pmania.it/hublists/PublicH ... config.bz2

GargoyleMT
DC++ Contributor
Posts: 3212
Joined: 2003-01-07 21:46
Location: .pa.us

Re: HubBOT.NET Project

Post by GargoyleMT » 2005-01-12 13:09

djechelon wrote:Any help? How does DC++ (in C++ language of course) get the userlist via socket stream?

DC++ may not get the user list at all - look at extensions.txt at the NoHello $Supports.

If you're doing something wrong protocol wise, use Ethereal. If you're doing something wrong code wise, I would look on VB.NET forums.

Todi
Forum Moderator
Posts: 699
Joined: 2003-03-04 12:16
Contact:

Post by Todi » 2005-01-12 13:44

Chimera is a bot written in VB.NET (source released under GPL), that can login to a hub and has a working socket stream handler. Perhaps it can give you some help.

Note: the "spider" you describe already exists, and is used by just about every hublist out there.. it's usually called a "Pinger".

Locked