• Welcome to Valhalla Legends Archive.
 

[VB][Closed-unsolved] Socket error... Still unsolved.

Started by Don Cullen, September 12, 2005, 06:25 PM

Previous topic - Next topic

rabbit

On a side note, your error handler assumes that RTE 6 is the only error your program can encounter in that routine, but it's not.  Also, right before "Exit Function" you should have "On Error GoTo 0".
Grif: Yeah, and the people in the red states are mad because the people in the blue states are mean to them and want them to pay money for roads and schools instead of cool things like NASCAR and shotguns.  Also, there's something about ketchup in there.

Don Cullen

#16
@l2k-Shadow, tried what you suggested-- no difference, still overflows-- but here's something interesting- if I execute the program when I first open VB, no overflow occurs. HOWEVER, if I click disconnect, then click connect, it overflows when sending 0x51. Interesting stuff. Still driving me crazy like usual, lol.

Instead of trying to describe stuff, I decided to just zip up my source code, and make it available for download so you can check it out directly. Maybe it's computer specific? Maybe it overflows on my laptop, but works fine for other computers?

Anyway, here's the source:

DMBot.zip

Keep in mind it's my first binary bot, so if the code looks horrible, my apologies! lol...

If you'd take a gander at it, I'd be immensely grateful! :) No need to fix the code for me, if you see the problem, feel free to let me know and I'll see if I can figure out how to solve it... I owe you guys on vL alot- I've learned so much about botmaking, not enough, but still alot. 

@Rabbit-- yeah, I just put that there because that's the only error that occurs with the SendPacket sub-- but you do have a point. So I re-coded the error handler, and added some stuff to the sub:

Public Function SendPacket(sck As Winsock, PacketID As Long, Optional PacketFormat As pPacketFormat = pBNET) As Boolean
    On Error GoTo DumpHex
    'Returns TRUE if packet was successfully sent. FALSE if not.
    If BNETSendComplete = False Then
        AddC vbRed, "Winsocket not available to send yet, please wait a moment..."
        Do
            DoEvents
        Loop Until BNETSendComplete = True
        AddC vbGreen, "Alright, it's open. Sending packet..."
    End If
    If sck.State = sckConnected Then
        'sck.SendData Chr(&HFF) & Chr(PacketID) & MakeMemory(Len(Buffer) + 4, pWORD) & Buffer
        sck.SendData Chr(&HFF) & Chr(PacketID) & MakeWORD(Len(Buffer) + 4) & Buffer
        SendPacket = True
    End If
    Clear
    On Error GoTo 0
    BNETSendComplete = False
    Exit Function
DumpHex:
    DMBot.BNET.Close
    AddC vbRed, " -- Error " & Err.Number & " (" & Err.Description & ") in procedure SendPacket in PacketBuffer class."
    Call DMBot.BNET_Close
    DumpPacket (Chr$(&HFF) & Chr$(PacketID) & MakeMemory(Len(Buffer) + 4, pWORD) & Buffer)
    Clear
End Function


Thanks for being so patient with me and my amateurish botmaking skills. :)

[Edited to avoid double posting]

Also, when you open the bot in vb, you'll need to put in your own login and cdkey, I removed mine for obvious reasons before zipping it up to upload. And the bot provides no way to set up the cdkey/login, it'll have to be done manually by setting the vars inside the Form_Load sub in DMBot.frm...
Regards,
Don
-------

Don't wonder why people suddenly are hostile when you treat them the way they shouldn't be- it's called 'Mutual Respect'.