problem with packet data sent by server

Results 1 to 3 of 3
  1. #1
    Member weertoop is offline
    MemberRank
    Apr 2013 Join Date
    82Posts

    Support problem with packet data sent by server

    hello,
    so recently there has been this AKCore TW sever release, i downloaded the files and tried the server, everything works well.

    now, i have been working on a KR server for quite some time and have made so much good progress in it that is not achieved in the TW server yet, and i really dont want to spend more time (if possible) reading and understanding new code.

    so i decided to convert my KR server to be able to work with the TW client (i know that i have to correct the packet structs and all that)

    my problem is, my server does not connect to the client, and after investigating, i discovered that i needed to send a handshake packet to the TW client in the OnAccept() function.

    but when i send the handshake packet, the data sent is wrong for some reason,

    here is my OnAccept() function:
    Code:
            Packet packet(0x06);
    	unsigned char buf[] = { 0x03, 0x00, 0xac, 0x86, 0xf5, 0x74 };
    	packet.SetPacket(buf, 0x06);
    	packet.GetPacketHeader()->bEncrypt = true;
    	PushPacket(&packet);
    and here is the packet data sent (notice the bold bytes):
    Code:
    0000   54 e1 ad f6 70 8c 40 8d 5c bd e4 16 08 00 45 00   T...p.@.\.....E.
    0010   00 32 5c 0a 40 00 80 06 00 00 c0 a8 00 64 c0 a8   .2\ @........d..
    0020   00 6a c4 18 c4 24 fe b0 bd 77 5e 8b 8c 68 50 18   .j...$...w^..hP.
    0030   08 05 82 43 00 00 0d 00 00 00 03 00 ac 86 f5 74   ...C...........t
    i tried the same thing in the AKCore server and i got this packet data:
    Code:
    0000   54 e1 ad f6 70 8c 40 8d 5c bd e4 16 08 00 45 00   T...p.@.\.....E.
    0010   00 30 5c 04 40 00 80 06 00 00 c0 a8 00 64 c0 a8   .0\ @........d..
    0020   00 6a c4 18 c4 1b 38 5f db 9a bb 59 83 f5 50 18   .j....8_...Y..P.
    0030   08 05 82 41 00 00 06 80 03 00 ac 86 f5 74         ...A.........t
    the first 4 bytes in my packet are wrong and i cant figure out why :(...
    i have disabled all RxDexrypt() and TxEncrypt() functions in my code (working with 9001.exe)...

    for some reason the packet header is registered as 4 bytes? i dont understand the problem here.

    NOTE: my code is originally taken from one of the githubs out there, and it is very similar to the AKCore code in this release, so any network code i have is probably identical to the one in the release. (i have checked most of it)


  2. #2
    Connoisseur of Fine Code SanGawku is offline
    ModeratorRank
    Oct 2006 Join Date
    CyberSpanksLocation
    642Posts

    Re: problem with packet data sent by server

    Code:
    CNtlPacket packet(0x06);
    	unsigned char buf[] = { 0x03, 0x00, 0xac, 0x86, 0xf5, 0x74 };
    	packet.SetPacket(buf, 0x06);
    	packet.GetPacketHeader()->bEncrypt = true;
    	PushHandshakePacket(&packet);
    This is what we use for it in AKCore.

    And then in on Dispatch. We send the next result.
    Code:
                            if header is 0x04
    			if (isHandshaken == false)
    			{
    				CNtlPacket packet2(0x22);
    				unsigned char buf2[] = { 0x10, 0x00, 0x84, 0xfb, 0x48, 0xf4, 0x8e, 0x5a, 0xb6, 0x67, 0xe2, 0x3d, 0x6e, 0x14, 0xb4, 0xa3, 0xc3, 0x24, 0x9e, 0x5f, 0xe3, 0xd1, 0xd5, 0x88, 0x10, 0x0d, 0x68, 0x4f, 0x3b, 0xa5, 0xed, 0x37, 0xed, 0x4a };
    				packet2.SetPacket(buf2, 0x22);
    				packet2.GetPacketHeader()->bEncrypt = false;
    				PushHandshakePacket(&packet2);
    				isHandshaken = true;
    				client = this;
    			}
    Also dont' use 9001. Just use this client.
    https://anonfile.com/X9dbN720n1/DBOTW_rar

    Its sad to see people working on TW at all.
    There is really no point, The alpha code is a better place to work on.
    you wont ever get new content in it :(

    - - - Updated - - -

    Another way you can do this is.
    Code:
    	uint8 rawData[] = { 0x06, 0x00, 0x03, 0x00, 0x30, 0x2C, 0x67, 0x4C };
    	Socket.Write((char*)rawData, sizeof(rawData));
    and for processing packet 0x04
    Code:
    		if (header->wOpCode == 4)
    		{
    			uint8 rawData2[] = { 0x22, 0x00, 0x10, 0x00, 0x49, 0xD1, 0xF1, 0x1C, 0x6D, 0x58, 0xF9, 0xC5, 0x30, 0x26, 0xA4, 0x7B,
    				0xB2, 0xD8, 0x2C, 0x86, 0x58, 0x60, 0x7B, 0xDD, 0xF0, 0x77, 0xCF, 0x25, 0x48, 0xB3, 0x65, 0x45,
    				0x38, 0x80, 0x14, 0x72 };
    			Write((char*)rawData2, sizeof(rawData2));

  3. #3
    Member weertoop is offline
    MemberRank
    Apr 2013 Join Date
    82Posts

    Re: problem with packet data sent by server

    Quote Originally Posted by SanGawku View Post
    Code:
    CNtlPacket packet(0x06);
        unsigned char buf[] = { 0x03, 0x00, 0xac, 0x86, 0xf5, 0x74 };
        packet.SetPacket(buf, 0x06);
        packet.GetPacketHeader()->bEncrypt = true;
        PushHandshakePacket(&packet);
    This is what we use for it in AKCore.

    And then in on Dispatch. We send the next result.
    Code:
                            if header is 0x04
                if (isHandshaken == false)
                {
                    CNtlPacket packet2(0x22);
                    unsigned char buf2[] = { 0x10, 0x00, 0x84, 0xfb, 0x48, 0xf4, 0x8e, 0x5a, 0xb6, 0x67, 0xe2, 0x3d, 0x6e, 0x14, 0xb4, 0xa3, 0xc3, 0x24, 0x9e, 0x5f, 0xe3, 0xd1, 0xd5, 0x88, 0x10, 0x0d, 0x68, 0x4f, 0x3b, 0xa5, 0xed, 0x37, 0xed, 0x4a };
                    packet2.SetPacket(buf2, 0x22);
                    packet2.GetPacketHeader()->bEncrypt = false;
                    PushHandshakePacket(&packet2);
                    isHandshaken = true;
                    client = this;
                }
    Also dont' use 9001. Just use this client.
    https://anonfile.com/X9dbN720n1/DBOTW_rar

    Its sad to see people working on TW at all.
    There is really no point, The alpha code is a better place to work on.
    you wont ever get new content in it :(

    - - - Updated - - -

    Another way you can do this is.
    Code:
        uint8 rawData[] = { 0x06, 0x00, 0x03, 0x00, 0x30, 0x2C, 0x67, 0x4C };
        Socket.Write((char*)rawData, sizeof(rawData));
    and for processing packet 0x04
    Code:
            if (header->wOpCode == 4)
            {
                uint8 rawData2[] = { 0x22, 0x00, 0x10, 0x00, 0x49, 0xD1, 0xF1, 0x1C, 0x6D, 0x58, 0xF9, 0xC5, 0x30, 0x26, 0xA4, 0x7B,
                    0xB2, 0xD8, 0x2C, 0x86, 0x58, 0x60, 0x7B, 0xDD, 0xF0, 0x77, 0xCF, 0x25, 0x48, 0xB3, 0x65, 0x45,
                    0x38, 0x80, 0x14, 0x72 };
                Write((char*)rawData2, sizeof(rawData2));
    thank you very much for this.

    and yes, the code i used is exactly the one in the AKCore code, i tried to mimic it as it seemed good enough to be working there.

    also, i tried updating my korean client with the files provided here:
    http://forum.ragezone.com/f880/guide...s-dbo-1164359/

    well, i know how to update the client, i have a working launcher that can do the updates for me, but i was getting an error with one of the RTP files:
    "Invalid patch file 0.60.0.RTP"
    any ideas? :/, maybe its just corrupted and i need to redownload the file, but it took me so much time to download considering it is a torrent with only 1 seed...

    you are 100% right about the korean client, and i would very much like to continue working with the one i have (self compiled, and i have some of my own packets declared :) )

    UPDATE:
    I redownloaded the 0.60.0.RTP file and it still gives me the same error. I still dont know where the problem lies :/, i would just go with what ive got for now.
    Last edited by weertoop; 13-08-19 at 01:19 AM.



Advertisement