Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6741417
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:43:21+00:00 2026-05-26T11:43:21+00:00

I’m makinga Java server for the last version of the draft. I managed to

  • 0

I’m makinga Java server for the last version of the draft. I managed to make the connection, and that’s working great.

The problem is that I don’t understand how the data is encoded, I’ve been trying to find some example of how it has to be done but I couldn’t find anything. so I’m trying to do it by myself but need some help.

Here is an image of the frame.

But I don’t understand where the payload begins. What is:

Extended payload length (16/63) (if payload len==126/127)

That’s the place where my payload should be?

Can someone give some help because as you may see, I’m completely lost…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T11:43:21+00:00Added an answer on May 26, 2026 at 11:43 am

    The problem is that the length does not always fit in 7 bits (you can only express the numbers 0 to 127 with 7 bits), and in that case either the following 2 or 8 bytes will be used to make the length fit:

    • 126 means the following 2 bytes are used for the length
    • 127 means the following 8 bytes are used for the length

    So the payload starts at either index 2, 4 or 10, if not encoded. When encoded, it starts at either 6, 8 or 14 (because there are 4 mask bytes).

    I previously posted some pseudocode about decoding the payload data.


    To actually get the length as a “real number” (instead of separate bytes), you can use bitwise shift operators as follows (in case there are two bytes for the length):

    var length = (bytes[2] << 8) | (bytes[3] << 0);
    

    This will calculate it like this:

    Suppose:

    • bytes[2] is 01101001 (105 in base 10)
    • bytes[3] is 10100101 (165 in base 10)

    Then << will be doing:

    01101001 00000000   // moved 8 places to the left, filled with zeroes
             10100101   // moved 0 places (nothing really happening, you can eliminate '<< 0')
    

    | is basically adding them:

    01101001 00000000
             10100101
    -----------------  |
    01101001 10100101      (in base 10 that's 27045)
    

    So if you have the bytes 105 and 165, then they represent a length of 27045.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I am currently running into a problem where an element is coming back from
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I have thousands of HTML files to process using Groovy/Java and I need to
I need a function that will clean a strings' special characters. I do NOT
I'm trying to create an if statement in PHP that prevents a single post

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.