#1
  1. Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Dec 2004
    Location
    Meriden, Connecticut
    Posts
    1,797
    Rep Power
    155

    My Last Question


    This might not actually be my "last question", but my bot now connects to battle.net, it can send messages, and be online. My only problem is that this only happens if I do not send my dataArrival. And when I do not do that, I can't receive any data from battle.net (messages, users joining, etc.). I'll show the code in VB6, and what I changed it to in Python.
    Code:
    Private Sub Winsock2_DataArrival(ByVal bytesTotal As Long)
        'Battle.net Data Arrival
        Dim strTmp As String
        Winsock2.GetData strTmp, vbString
        Battlenet.ParseData strTmp
    End Sub
    Code:
    def dataArrival():
        strTemp = ""
        s.recv(strTmp)
        ParseData(strTmp)
    My biggest problem is, where does this strTmp come from?
  2. #2
  3. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    I've never used VB so Im guessing here but I think your dataArrival() function should probably look more like this:

    Code:
    def dataArrival():
        tmpStr = s.recv()
        ParseData(tmpStr)
    My assumption is that you want to parse the data received from the socket, so the data is assigned tmpStr and passed to ParseData(). Since in Python s.recv() takes only one argument: the max' number bytes to read from the socket, I'd opted for the default but you can change this if needed .

    Anyway, as far as I can see strTmp doesn't in your code so it can't come form anywhere.

    Hope this is of some help,

    Mark.
    programming language development: www.netytan.com Hula


IMN logo majestic logo threadwatch logo seochat tools logo