Valhalla Legends Forums Archive | Battle.net Bot Development | [SOCKET_DATAARRIVAL]Invalid procedure call or argument

AuthorMessageTime
TriCk
[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 =
[code]
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]
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... :-\
September 18, 2004, 9:19 AM
Soul Taker
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 [code]lngLen = Val("&H" & Buffer(Index).StrToHex(StrReverse(Mid(strBuffer, 3, 2))))[/code] doing anyway?
September 18, 2004, 9:31 AM
BaDDBLooD
Basically Val("&H" & strToHex(StrReverse(mid,strBuffer,3,2))) is a really bad substitute for copy memory.
September 18, 2004, 1:03 PM
Soul Taker
[quote author=BaDDBLooD link=board=17;threadid=8726;start=0#msg80684 date=1095512629]
Basically Val("&H" & strToHex(StrReverse(mid,strBuffer,3,2))) is a really bad substitute for copy memory.
[/quote]
Yea, but Buffer(Index).StrToHex(StrReverse(Mid(strBuffer, 3, 2))) seems uh... weird.
September 18, 2004, 1:27 PM
BaDDBLooD
we'll just going to "skip over" that part!
September 18, 2004, 1:39 PM
Flame
I'm guessing you forgot this part
[code]frmMain.sckBNCS.GetData strTemp, vbString[/code]
September 18, 2004, 1:47 PM
TriCk
Yea my bad, heres all the code...
[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
[/code]
September 19, 2004, 12:06 AM

Search