Hello, I've been trying to read packets from the server directly from the memory, I saw some project in here made by klusbert if I'm not wrong, where it was reading the "Incoming Data" address.
Anyway, I got it working good, it is reading the loot messages packets from the address ok, the problem is when my internet freezes a little bit(or a lot) I saw that it was missing some messages, after some tests watching a TibiaCast record in the "speed 15", I saw that happening too, so I confirmed that the problem is the speed to read the specific address, looks like the packets overrite the address too fast, so I lose some "blocks" of the server log.
Since my "packet reader" has no delay in a while loop, there is no way to improve its speed I guess, I'm almost sure that it's not the speed it reads, but the speed tibia writes to the address, idk, I still noob in that part yet, so I was thinking, there is a way to hook the "recv" address to not miss anything? I don't want to use a proxy or something related to that, cuz I want to avoid get a debug in my tibia client with a simple program, I just want to find a way to improve this kind of read.
This is a simple code about it:
PHP Code:
private void Reader()
{
while (true)
{
try
{
ParsePacket(Data());
}
catch { }
Thread.Sleep(1);
}
}
private void ParsePacket(byte[] data)
{
//From TibiaAPI
NetworkMessage msg = new NetworkMessage(data);
msg.Position = 8;//point directly to the packet type
while (msg.Position <= msg.Data.Length)
{
Enums.IncomingPacketType type = (Enums.IncomingPacketType)msg.GetByte(); //Get the packet type
if (type != 0)
{
switch (type)
{
case Enums.IncomingPacketType.TextMessage:
GetMessage(msg);
break;
case default:
break;
}
}
}
}
private void GetMessage(NetworkMessage msg)
{
try
{
byte type = msg.GetByte();
if (type == 0x1F) //Loot message
{
string message = msg.GetString();
Console.WriteLine(message);
}
}
catch { }
}