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

  • SEARCH
  • Home
  • 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 8386807
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T18:02:34+00:00 2026-06-09T18:02:34+00:00

I am creating a UDP packet to configure a GPS modem in java. One

  • 0

I am creating a UDP packet to configure a GPS modem in java. One of the sections of the packet is a phone number and I have been given the follow information:

The Phone number is 64 bits.

Byte 7 is = 0x00 (big endian).

Bytes 4-6 = area code (little endian).

Bytes 0-3 = other digits (little endian).

What I have done so far:

The Phone number is : 123 4567890
I converted the byte sections into hex:
123 = 0x00007B
4567890 = 0x0045B352

    ByteBuffer UDPConfigModem = ByteBuffer.allocate(8);

    byte areaCode1 = (0x00007B >> 8) & 0xFF;
    byte areaCode2 = (0x00007B >> 16) & 0xFF;

    UDPConfigModem.putInt((byte) 0x0045B352).order(ByteOrder.LITTLE_ENDIAN);
    UDPConfigModem.put((byte) areaCode2).order(ByteOrder.LITTLE_ENDIAN);
    UDPConfigModem.put((byte) areaCode1).order(ByteOrder.LITTLE_ENDIAN);
    UDPConfigModem.put((byte) 0x00007B).order(ByteOrder.LITTLE_ENDIAN);     
    UDPConfigModem.put((byte) 0x00);

Because the other digits requires 4 bytes I just used a putInt and ordered the bytes, I am pretty sure that is not the problem.

The area code requires 3 bytes and there isn’t a variable that I know of that has that, so I read up on bit shifting and used the logic from How do I convert a 24-bit integer into a 3-byte array? to shift it. This is where I believe my problem is.

Byte 7 is pretty straight forward.

I should be getting a response back from the modem if the phone number is sent correctly, but when monitoring it on wire shark I see the packet send but no response is sent back.

I was wondering if you guys could see any errors or better ways to go about this?

Thanks.

  • 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-06-09T18:02:36+00:00Added an answer on June 9, 2026 at 6:02 pm

    Your code is confusing. A byte isn’t little or big endian. Endianness only applies to a sequence of bytes representing a larger number such as an Integer. .order on ByteBuffer swaps the entire buffer which isn’t what you want.

    putInt((byte) 0x0045B352) isn’t going to work – you’ll probably just get the lower byte of that integer. I suggest you use this answer https://stackoverflow.com/a/4378416/116509 and put the bytes in one-by-one (there should be no reason to use a cast).

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

Sidebar

Related Questions

I have been investigating about creating a UDP server, at first i though i
I have been recently writing a UDP server for a 2D shooter game I
I am creating a UDP Server.I found following code reference from MSDN.Can any one
I'm creating 2 programs which one of them sends UDP packets from an Adnroid
Creating a JApplet I have 2 Text Fields, a button and a Text Area.
I am creating a UDP socket ( AF_INET , SOCK_DGRAM , IPPROTO_UDP ) via
Creating an installer for possible remote systems so that if they do not have
I'm creating an UDP SocketServer, and I would like to shutdown if I'm receiving
I am creating a dhcp client in Linux(Ubuntu). I am creating a udp socket
we have one main application, which executes up to 5 different exes. These exes

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.