Page 1 of 1

Packet Format Header

Posted: 31 Jan 2025, 19:27
by rickxsh
Difference between Packages:

I'm trying to send data packets using SmartFoxServer, but I've found an important difference between the packet I'm trying to send and what the server expects.

First of all, this is the package I need to send:

Code: Select all

8000 4312 0003 0001 6302 0100 0161 0300  ..C.....c....a..
0d00 0170 1200 0300 0163 0800 036a 7073  ...p.....c...jps
0001 7204 ffff ffff 0001 7012 0002 0002  ..r.......p.....
6964 0800 0935 3432 3633 3538 3736 0001  id...542635876..
2e04 2cab 4507                           ..,.E.


See that it starts with 80 00 43, so far, no problems, so I removed the ( 80 00 43) to use getDump() and see the object, and I get this:

Code: Select all

(byte) c: 1
(short) a: 13
(sfs_object) p:
    (utf_string) c: jps
    (int) r: -1
    (sfs_object) p:
        (utf_string) id: 542635876
        (int) .: 749421831


And then in an attempt to send this package to the server, I used the following code:

Code: Select all

private void JoinPersonalStudio()
{
    SFSObject data = new SFSObject();
    data.PutByte("c", 1);
    data.PutShort("a", 13);

    SFSObject innerData = new SFSObject();
    innerData.PutInt("r", -1);

    SFSObject innerInnerData = new SFSObject();
    innerInnerData.PutUtfString("id", "542635876");
    innerInnerData.PutInt(".", 749421831);

    innerData.PutSFSObject("p", innerInnerData);
    data.PutSFSObject("p", innerData);

    sfs.Send(new ExtensionRequest("jps", data));
}


However, the returned packet is different. Notably, the beginning of the packet doesn't contain 80 00 43 as expected. Here is the packet that was sent:

Code: Select all

12 00 03 00 01 63 02 01 00 01 61 03 00 0d 00 01    .....c....a.....
70 12 00 03 00 01 63 08 00 03 6a 70 73 00 01 72    p.....c...jps..r
04 ff ff ff ff 00 01 70 12 00 03 00 01 63 02 01    .......p.....c..
00 01 61 03 00 0d 00 01 70 12 00 02 00 01 72 04    ..a.....p.....r.
ff ff ff ff 00 01 70 12 00 02 00 02 69 64 08 00    ......p.....id..
09 35 34 32 36 33 35 38 37 36 00 01 2e 04 2c ab    .542635876....,.
45 07                                              E.     


Questions

    1- The packet I sent is different from the one I received, especially at the beginning, which is missing the 80 00 43 header. What do these first bytes represent?

    2-Why can't I build exactly the same package?

    3- is it really done using ExtensionRequest as I imagined?

I would like some help and, if possible, explain to me a little about what I need to understand to do what I need.

Re: Packet Format Header

Posted: 01 Feb 2025, 09:50
by Lapo
Hi,
the client side API exist for the purpose of hiding the protocol complexity and letting you deal with your app logic.
Why exactly do you want to deal with the low level protocol manually?

Re: Packet Format Header

Posted: 01 Feb 2025, 12:01
by rickxsh
I really need to send the packet in the same format as the example, can you at least explain to me why the header is different?