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 6802253
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:12:03+00:00 2026-05-26T19:12:03+00:00

I`m trying to make my Go server send POST request with an array of

  • 0

I`m trying to make my Go server send POST request with an array of bytes to my Java application.

The original data bytes look like (with added line brakes):

FABFB5DA
76657273696F6E000000000055000000
67C4256E409C0000010000000000000013A3BD4E
00000000010000000000000000000000000000000000
FFFF6D7B74F5479D010000000000000000000000000000000000
FFFF51DB4826479D59128BC986A833460001000000

What I’m receiving in Java looks like:

2D9F8B52044
76657273696F6E000000000055000000
C856CDEB40FA0000010000000000000009A33A94E
00000000010000000000000000000000000000000000
2C72C76D7B7413147F9010000000000000000000000000000000000
2C72C75120AC482647F920AB4678B620194D4E0001000000

I tried posting the data to another function of my Go application and it works fine.

As the base for my Java application, I used the code from
http://fragments.turtlemeat.com/javawebserver.php

It is altered to handle POST requests. After clearing out the first couple lines of HTTP request with input.readLine(), I read the data with:

int hex=0;
while((hex=input.read())>-1){
System.out.printf("%02X", hex);
}

The hex dump from Wireshark looks like:

0000   50 4f 53 54 20 2f 68 61 6e 64 6c 65 70 6f 73 74  POST /handlepost
0010   20 48 54 54 50 2f 31 2e 31 0d 0a 43 6f 6e 74 65   HTTP/1.1..Conte
0020   6e 74 2d 54 79 70 65 3a 20 0d 0a 48 6f 73 74 3a  nt-Type: ..Host:
0030   20 6c 6f 63 61 6c 68 6f 73 74 3a 38 30 38 30 0d   localhost:8080.
0040   0a 43 6f 6e 74 65 6e 74 2d 4c 65 6e 67 74 68 3a  .Content-Length:
0050   20 31 30 39 0d 0a 41 63 63 65 70 74 2d 45 6e 63   109..Accept-Enc
0060   6f 64 69 6e 67 3a 20 67 7a 69 70 0d 0a 55 73 65  oding: gzip..Use
0070   72 2d 41 67 65 6e 74 3a 20 41 70 70 45 6e 67 69  r-Agent: AppEngi
0080   6e 65 2d 47 6f 6f 67 6c 65 3b 20 28 2b 68 74 74  ne-Google; (+htt
0090   70 3a 2f 2f 63 6f 64 65 2e 67 6f 6f 67 6c 65 2e  p://code.google.
00a0   63 6f 6d 2f 61 70 70 65 6e 67 69 6e 65 29 0d 0a  com/appengine)..
00b0   0d 0a fa bf b5 da 76 65 72 73 69 6f 6e 00 00 00  ......version...
00c0   00 00 55 00 00 00 e9 56 ea 91 40 9c 00 00 01 00  ..U....V..@.....
00d0   00 00 00 00 00 00 09 a3 bd 4e 00 00 00 00 01 00  .........N......
00e0   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
00f0   ff ff 6d 7b 74 f5 47 9d 01 00 00 00 00 00 00 00  ..m{t.G.........
0100   00 00 00 00 00 00 00 00 00 00 ff ff 51 db 48 26  ............Q.H&
0110   47 9d 20 c7 46 78 a6 d5 4d 4e 00 01 00 00 00     G. .Fx..MN.....

How should I go about properly reading those bytes?

  • 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-26T19:12:03+00:00Added an answer on May 26, 2026 at 7:12 pm

    The problem — or a problem — is in this bit:

        BufferedReader input =
            new BufferedReader(new InputStreamReader(connectionsocket.
            getInputStream()));
    

    The InputStreamReader has to translate from bytes to characters, and you’re not telling it how to do that — or, put another way, you’re implicitly telling it to use your platform’s default character-set. That seems to be working fine for bytes in the ASCII range (00 to 7F), but breaking on bytes outside that range.

    Your application seems to be sending binary data (by which I mean non-textual data); you should either change it to encode everything in a textual form, or else not use InputStreamReader. (Unfortunately, this makes it a bit trickier to handle the header lines, since you can’t use BufferedReader.readLine() anymore.)

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

Sidebar

Related Questions

I'm trying to make this call to send data to the server: $.ajax({ type:
I am trying to make a server which can send data to more than
I trying to make http - post call. The server that i send him
I am trying to make an asynchronous request with POST method from a web
I'm trying to make a little client-server script like many others that I've done
I'm trying to make a simple http client server using java. It will show
I am trying to make a desktop application in python to post messages to
I've been trying to make an AJAX request to an external server. I've learned
I'm trying to make an EXTJS application to send email with an attachment. So
I'm trying to send a POST request from an external Ruby script to a

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.