Thread: Client Opcodes

Results 1 to 8 of 8
  1. #1 Client Opcodes 
    Banned
    Join Date
    Jul 2009
    Posts
    327
    Thanks given
    6
    Thanks received
    11
    Rep Power
    0
    Hey,

    I have been investigating client opcodes and how they are used between the client and server. Here is an example:

    public void sendMessage(String s) {
    outStream.createFrameVarSize(253);
    outStream.writeString(s);
    outStream.endFrameVarSize();
    }

    What does 'endFrameVarSize' actually do?

    And whats the difference between 'createFrameVarSize()' and just
    'createFrame()'?

    EDIT: I have been looking at more examples, can someone please define the following:

    writeQWord

    writeByte

    writeString

    createFrameVarSize

    createFrame

    endFrameVarSize

    writeWordA

    endFrameVarSizeWord

    writeWord

    writeWordBigEndianA

    Im just confused about the difference between them all and how to know which one to use for which opcode

    Reply With Quote  
     

  2. #2  
    Registered Member
    Linux's Avatar
    Join Date
    Feb 2008
    Age
    29
    Posts
    597
    Thanks given
    104
    Thanks received
    103
    Rep Power
    1451
    Creates the end frame var size dah!!

    :coolface:

    One create the frame var size and the other creates the frame dah

    :coolface:
    Reply With Quote  
     

  3. #3  
    Member Client Opcodes Market Banned


    Luke132's Avatar
    Join Date
    Dec 2007
    Age
    35
    Posts
    12,574
    Thanks given
    199
    Thanks received
    7,106
    Rep Power
    5000
    Well the packet is an array of bytes, the first byte is the opcode, then there's the packet data.

    Everytime a packet is recieved by the client, it reads the first byte and that number determines what happens next (you can see this in the 317 client in the parsePackets method).

    CreateFrameVarSize means it dosen't know the length of the packet yet (since things such as text changes depending on how long the words are), but most packets have their sizes pre-set in the packetSizes array, this is also true in the client.
    Reply With Quote  
     

  4. #4  
    Banned
    Join Date
    Jul 2009
    Posts
    327
    Thanks given
    6
    Thanks received
    11
    Rep Power
    0
    Quote Originally Posted by Luke132 View Post
    Well the packet is an array of bytes, the first byte is the opcode, then there's the packet data.

    Everytime a packet is recieved by the client, it reads the first byte and that number determines what happens next (you can see this in the 317 client in the parsePackets method).

    CreateFrameVarSize means it dosen't know the length of the packet yet (since things such as text changes depending on how long the words are), but most packets have their sizes pre-set in the packetSizes array, this is also true in the client.
    Thanks for sharing your expertise, you never fail to impress.
    Reply With Quote  
     

  5. #5  
    Doctor p - Sweet Shop

    Join Date
    Apr 2007
    Age
    31
    Posts
    6,835
    Thanks given
    150
    Thanks received
    584
    Rep Power
    2595
    Qword = long
    Dword = integer
    Word = short

    Reply With Quote  
     

  6. #6  
    Banned
    Join Date
    Jul 2009
    Posts
    327
    Thanks given
    6
    Thanks received
    11
    Rep Power
    0
    Quote Originally Posted by Venenifer View Post
    Qword = long
    Dword = integer
    Word = short
    You absolute beast.
    Reply With Quote  
     

  7. #7  
    Registered Member
    Its paris's Avatar
    Join Date
    Apr 2009
    Posts
    1,141
    Thanks given
    56
    Thanks received
    234
    Rep Power
    689
    byte = byte (1 byte)
    word = short (2 bytes)
    dWord = double word = integer (2 * 2 bytes = 4 bytes)
    qWord = quadriple word = double dword = long (2 * 4 bytes = 8 bytes)

    BigEndian is the normal way of writing a sequence of bytes, where the bytes with the higher (possible) values come first (big end first).
    LittleEndian is another way of writing a sequence of bytes, where the bytes with the lower (possible) values come first (little end first).
    Example: an integer represented by 4 bytes ABCD.
    BigEndian: ABCD (A is relatively worth more than B, ...).
    LittleEndian: DCBA (D is relatively worth less than C, ...).

    CreateFrame marks the start of creating a packet with a known size.

    EndFrameVarSize marks the end of a packet with 'unknown' size where the number of bytes is smaller than or equal to 0xFF (255).
    EndFrameVarSizeWord marks the end of a packet with 'unknown' size where the number of bytes is smaller than or equal to 0xFFFF (65535).

    Write String writes a string ending with either 0 (closing zero) or 10 (line feed) (I'm not sure which one).

    Knowing this you can combine the words to get a meaningfull explenation:
    Example
    WriteLittleEndianWord:
    A short represented by the bytes AB: BA.

    There's one special case you've requested to know:
    WriteWordA and WriteBigEndianWordA: I'm afraid your methods are named incorrectly because if they were, your 2 methods should be the same (if Big or Little Endian isn't specified, it's Big endian). I'm show you what the BE (Big endian) one and the LE (Little endian) one looks like so you can see for yourself.

    A short, represented by the bytes: AB.
    WriteLEWordA: (B + 128) A
    WriteWordA (WriteBEWordA): A (B + 128)
    As you can see the order (LE/BE) still stands. The 'A' means that during the writing, 128 should be added to the lowest byte (here being B).

    If you have any more questions, don't hesitate to contact me.
    Reply With Quote  
     

  8. #8  
    Banned
    Join Date
    Jul 2009
    Posts
    327
    Thanks given
    6
    Thanks received
    11
    Rep Power
    0
    Quote Originally Posted by TheChosenOne View Post
    byte = byte (1 byte)
    word = short (2 bytes)
    dWord = double word = integer (2 * 2 bytes = 4 bytes)
    qWord = quadriple word = double dword = long (2 * 4 bytes = 8 bytes)

    BigEndian is the normal way of writing a sequence of bytes, where the bytes with the higher (possible) values come first (big end first).
    LittleEndian is another way of writing a sequence of bytes, where the bytes with the lower (possible) values come first (little end first).
    Example: an integer represented by 4 bytes ABCD.
    BigEndian: ABCD (A is relatively worth more than B, ...).
    LittleEndian: DCBA (D is relatively worth less than C, ...).

    CreateFrame marks the start of creating a packet with a known size.

    EndFrameVarSize marks the end of a packet with 'unknown' size where the number of bytes is smaller than or equal to 0xFF (255).
    EndFrameVarSizeWord marks the end of a packet with 'unknown' size where the number of bytes is smaller than or equal to 0xFFFF (65535).

    Write String writes a string ending with either 0 (closing zero) or 10 (line feed) (I'm not sure which one).

    Knowing this you can combine the words to get a meaningfull explenation:
    Example
    WriteLittleEndianWord:
    A short represented by the bytes AB: BA.

    There's one special case you're requested to know:
    WriteWordA and WriteBigEndianWordA: I'm afraid your methods are named incorrectly because if they were, your 2 methods should be the same (if Big or Little Endian isn't specified, it's Big endian). I'm show you what the BE (Big endian) one and the LE (Little endian) one looks like so you can see for yourself.

    A short, represented by the bytes: AB.
    WriteLEWordA: (B + 128) A
    WriteWordA (WriteBEWordA): A (B + 128)
    As you can see the order (LE/BE) still stands. The 'A' means that during the writing, 128 should be added to the lowest byte (here being B).

    If you have any more questions, don't hesitate to contact me.
    Wow, there are some really great people on this forum who will go out of their way to help others. Rep+
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •