Valhalla Legends Archive

Programming => Battle.net Bot Development => Topic started by: TriCk on September 18, 2004, 04:19 AM

Title: [SOCKET_DATAARRIVAL]Invalid procedure call or argument
Post by: TriCk on September 18, 2004, 04:19 AM
[VB6]
I was logging errors in the connection of my proxies and noticed something that i need help fixing...

[SOCKET_DATAARRIVAL]Invalid procedure call or argument[-8169]

Error = Invalid procedure call or argument

Reason =

   Static strBuffer As String
   Dim strTemp As String, lngLen As Long
   strBuffer = strBuffer & strTemp
   While Len(strBuffer) > 4
   lngLen = Val("&H" & Buffer(Index).StrToHex(StrReverse(Mid(strBuffer, 3, 2))))
   If Len(strBuffer) < lngLen Then Exit Sub
   Buffer(Index).Parse CLng(Index), (Left(strBuffer, lngLen))
   strBuffer = Mid(strBuffer, lngLen + 1)
   Wend


Code thats being highlighted: (Left(strBuffer, lngLen))
lngLen = -8169

This procedure is trying to get the 'Left' section of it, but it realises its not possible, is there a way to fix this and let the connection still get to my 'Parse' sub? Currently i've just made it so it skips this part completely but the bot doesnt connect then so this is useless... :-\
Title: Re:[SOCKET_DATAARRIVAL]Invalid procedure call or argument
Post by: Soul Taker on September 18, 2004, 04:31 AM
I don't see you actually getting the data from anywhere.  strTemp isn't being assigned anything, and strBuffer isn't being assigned anything (itself + strTemp, neither of which should hold any data).  Either you're not giving enough code or you're not storing the data properly.

Also, what is lngLen = Val("&H" & Buffer(Index).StrToHex(StrReverse(Mid(strBuffer, 3, 2)))) doing anyway?
Title: Re:[SOCKET_DATAARRIVAL]Invalid procedure call or argument
Post by: BaDDBLooD on September 18, 2004, 08:03 AM
Basically Val("&H" & strToHex(StrReverse(mid,strBuffer,3,2))) is a really bad substitute for copy memory.
Title: Re:[SOCKET_DATAARRIVAL]Invalid procedure call or argument
Post by: Soul Taker on September 18, 2004, 08:27 AM
Quote from: BaDDBLooD on September 18, 2004, 08:03 AM
Basically Val("&H" & strToHex(StrReverse(mid,strBuffer,3,2))) is a really bad substitute for copy memory.
Yea, but Buffer(Index).StrToHex(StrReverse(Mid(strBuffer, 3, 2))) seems uh... weird.
Title: Re:[SOCKET_DATAARRIVAL]Invalid procedure call or argument
Post by: BaDDBLooD on September 18, 2004, 08:39 AM
we'll just going to "skip over" that part!
Title: Re:[SOCKET_DATAARRIVAL]Invalid procedure call or argument
Post by: Flame on September 18, 2004, 08:47 AM
I'm guessing you forgot this part
frmMain.sckBNCS.GetData strTemp, vbString
Title: Re:[SOCKET_DATAARRIVAL]Invalid procedure call or argument
Post by: TriCk on September 18, 2004, 07:06 PM
Yea my bad, heres all the code...

Private Sub Socket_DataArrival(Index As Integer, ByVal bytesTotal As Long)
Static strBuffer As String
Dim strTemp As String, lngLen As Long
   Socket(Index).GetData strTemp, vbString
   strBuffer = strBuffer & strTemp
   While Len(strBuffer) > 4
   lngLen = Val("&H" & Buffer(Index).StrToHex(StrReverse(Mid(strBuffer, 3, 2))))
   If Len(strBuffer) < lngLen Then Exit Sub
   Buffer(Index).Parse CLng(Index), (Left(strBuffer, lngLen))
   strBuffer = Mid(strBuffer, lngLen + 1)
   Wend
End Sub