YEy i has custom title^_^
- Joined
- Sep 29, 2006
- Messages
- 452
- Reaction score
- 67
so im about to start building my emulator so far made function to encrypt/decrypt the packets and simple server that listen socket and send packets to client anyway..
i was wondering what would be best way to code packets like i got this packet here
47 20 1A 00 AD 01 00 00 01 0F 00 32 31 38 2E 31 34 35 2E 35 35 2E 31 37 30 00 98 21 00 00
the structure is something like this:
packet id
packet length
random crap
ip length
ip
so how could i make something smart out from this, i tried make public byte with string ip to declare the ip but it looks stupid heres the code of it
it can be used like packets.SendIp("218.145.55.170") just wondering if there is any smarter ways to do this and when i build emulator i need make it answer packets by reading the packet id, if im right?
like hundred of cases then make packet builder build the answer for those packets or something like this if anyone could clear me out abit do so
i was wondering what would be best way to code packets like i got this packet here
47 20 1A 00 AD 01 00 00 01 0F 00 32 31 38 2E 31 34 35 2E 35 35 2E 31 37 30 00 98 21 00 00
the structure is something like this:
packet id
packet length
random crap
ip length
ip
so how could i make something smart out from this, i tried make public byte with string ip to declare the ip but it looks stupid heres the code of it
Code:
public byte[] SendIp(string ip)
{
byte[] test;
test = Encoding.ASCII.GetBytes(ip);
byte[] packet;
packet = new byte[30];
packet[0] = 0x47;
packet[1] = 0x20;
packet[2] = (byte)(packet.Length); // packet length
packet[3] = 0x00;
packet[4] = 0xAD;
packet[5] = 0x01;
packet[6] = 0x00;
packet[7] = 0x00;
packet[8] = 0x01;
packet[9] = (byte)(test.Length); // ip length
packet[10] = 0x00;
for (int i = 0; i > test.Length; i++)
{
packet[10 + i] = test[i];
}
packet[25] = 0x00;
packet[26] = 0x98;
packet[27] = 0x21;
packet[28] = 0x00;
packet[29] = 0x00;
return packet;
}
like hundred of cases then make packet builder build the answer for those packets or something like this if anyone could clear me out abit do so