• Welcome to Valhalla Legends Archive.
 

[SOCKET_DATAARRIVAL]Invalid procedure call or argument

Started by TriCk, September 18, 2004, 04:19 AM

Previous topic - Next topic

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 =

   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... :-\

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 lngLen = Val("&H" & Buffer(Index).StrToHex(StrReverse(Mid(strBuffer, 3, 2)))) doing anyway?

BaDDBLooD

Basically Val("&H" & strToHex(StrReverse(mid,strBuffer,3,2))) is a really bad substitute for copy memory.
There are only two kinds of people who are really fascinating: people who know absolutely everything, and people who know absolutely nothing.

Soul Taker

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.

BaDDBLooD

There are only two kinds of people who are really fascinating: people who know absolutely everything, and people who know absolutely nothing.

Flame

I'm guessing you forgot this part
frmMain.sckBNCS.GetData strTemp, vbString

TriCk

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