Re: Winsock Buffer Problem
OK. 1st things 1st, have you testing this WITHOUT decryption?
Re: Winsock Buffer Problem
Yes, it was tested without the encryption before hand and the same problems have been happening. We have been trying to rewrite the buffer for a few days now. Between the both of us we are stumpped. Ive probably rewriten it more then a thousand times with no luck.
Tonight I rewrote it to a point where the packets get past the buffer and onto the handler but it gets a subscript out of range error when it trys to set the players hp and mp. Which I dont understand because the value of a new characters hp / mp are both 30/30.
And when the error happens and I debug it highlights the line. I hover the mouse over values of things and it does the popup bubble saying what it equals and there is no problem with what it equals.
So yea, Im totally stummped.
I rewrote the buffer to this to get to the above:
Code:
Sub IncomingData(ByVal DataLength As Long)
Dim Buffer As String
Dim Packet As String
Dim A As String
Dim Start As Integer
frmScourge.Socket.GetData Buffer
Buffer = Decrypt(Buffer, EncryptionKey)
PlayerBuffer = PlayerBuffer & Buffer
Start = InStr(PlayerBuffer, END_CHAR)
Do While Start > 0
Start = InStr(PlayerBuffer, END_CHAR)
Packet = Mid(PlayerBuffer, 1, Start - 1)
PlayerBuffer = Mid(PlayerBuffer, Start + 1, Len(PlayerBuffer))
Start = InStr(PlayerBuffer, END_CHAR)
Loop
If Len(Packet) > 0 Then
Call HandleData(Packet)
End If
End Sub
Ps: Sorry for posting this in the wrong section didnt notice there was a specific spot to post winsock problems now.
Pss.. also just noticed you said in your post "WITHOUT decryption", did you mean without encryption completely or without decrypting the packets? Cause if the packets arnt decrypted nothing will happen.
Re: Winsock Buffer Problem
On a side note, with the above buffer, or I might have changed it a little, dont remember, but I get a subscript error. VB then highlights this line:
Code:
Player(MyIndex).MaxHP = Val(Section(1))
Ok with this MyIndex is the index the player gets from the server (for the socket). MaxHP sets the players maxhp in the game.
Then Val() is the value, the buffer sends the packet to the handle which then splits the packets into 4 sections:
Command :: Value 1 :: Value 2 :: Value 3
Section 0 is the command then 1-3 are the values.
Section(1) in the above case equals 30 when the error happens. So I dont see why this is getting an error at that point in the code.
Any idea's?