| Mirage Source http://web.miragesource.net/forums/ |
|
| Packet Checker http://web.miragesource.net/forums/viewtopic.php?f=210&t=666 |
Page 1 of 1 |
| Author: | William [ Fri Oct 20, 2006 5:11 pm ] |
| Post subject: | Packet Checker |
Difficulty: 1/5 Introduction Has it ever happened to you, that you send packets that does not exist? Well, if you add this, you will be warned when a packet is sent that does not have a reciever. Tutorial Start: Client Side (IF) First, make sure that all the If (LCase(Parse(0)) in Sub HandleData has a Exit Sub before the End if. Ex) Code: ' :::::::::::::::::::: ' :: Weather packet :: ' :::::::::::::::::::: If (LCase(Parse(0)) = "weather") Then GameWeather = Val(Parse(1)) [b]Exit Sub[/b] End If After that, at the bottom of of Sub HandleData, add this: Code: Call SendData("PacketError" & SEP_CHAR & Parse(0) & SEP_CHAR & END_CHAR) Server Side Now make a listbox on the server and name it lstDebugPacket. Now anywere in Sub HandleData, add: Code: ' ::::::::::::::::::::::::::: ' :: Type the packet error :: ' ::::::::::::::::::::::::::: If LCase(Parse(0)) = "PacketError" Then frmServer.lstDebugPacket.AddItem "Server-Client" & Parse(1) & " | " & date & " | " & time End If Now, make sure all If LCase(Parse(0)) in Sub HandleData has a ExitSub, as you did for the Client. And at the bottom add: Code: frmServer.lstDebugPacket.AddItem "Client-Server" & Parse(1) & " | " & date & " | " & time Tutorial Start: Client Side (Select Case) So now if you use select case, you use pretty much the same system, but at the bottom of Sub HandleData, instead of adding that line of code, you add this before it: Code: Case Else
Thats it! Now when a packet that does not exist in your game/engine is found. It will be typed in the listbox, so you easily can debug and find it |
|
| Page 1 of 1 | All times are UTC |
| Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |
|