|
-
Mar 15th, 2005, 02:07 PM
#1
Thread Starter
Hyperactive Member
Winsock Buffer Problem
Ok, with winsock, a friend and I are using encryption to send packets for our game. The problem we are having is when the game client recieves a packet with our home made encryption, the encryption key wont work unless its one byte in size.
When the packet is recieved on the client its send to a buffer to decrypt the packet and check it. Then send it to the handler to decide what to do with the packet.
This is the buffer we have right now:
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, vbString, DataLength
Buffer = Decrypt(Buffer, EncryptionKey)
PlayerBuffer = PlayerBuffer & Buffer
Start = InStr(PlayerBuffer, END_CHAR)
Do While Start > 0
Packet = Mid(PlayerBuffer, 1, Start - 1)
PlayerBuffer = Mid(PlayerBuffer, Start + 1, Len(PlayerBuffer))
Start = InStr(PlayerBuffer, END_CHAR)
If Len(Packet) > 0 Then
Call HandleData(Packet)
End If
Loop
End Sub
When the client gets data on the winsock control it calls that sub to buffer / decrypt the packet.
Also, on the server it uses the same buffer to read the packets, so if this one must change the server buffer has to change as well.
The exact problem we are having is the client can connect to the server, let you login and start playing, but the server is not buffering the sent packets from the client that allow you to do things such as drop items, equip items, and so on.
We have checked the packets and found no problems with how they are recieved / sent and pin-pointed the problem to the buffer we have.
(We have packet sniffed the game and decrypted the packets by hand and found no problems with them.)
(Please note that I cant put our encryption on here for safty reasons toward the game.)
If your able to help with what I can give, please do so.
Thanks in advance.
PS: To ensure that you under stand this, the packets are setup in sections using the encryption.
When the packet is decrypted they read in sections like this:
COMMAND¥WHATTODO¥HOWTODOIT¥í
The ¥ is the spacer in the packet, and the í is our end of packet symble. The buffer looks for the end of packet symble to start buffering the packet.
Hope someone can help us with our problem..
If my post was helpful please rate it 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|