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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T12:57:30+00:00 2026-05-15T12:57:30+00:00

I am using sockets to create a POST request to a given server. The

  • 0

I am using sockets to create a POST request to a given server. The response comes back mostly ok, and I’m using an InputStream with an encoding of “UTF-8” to read the response from the server. Most of the response makes sense and I’m able to view the HTML correctly, however, seemingly at random, I see codes such as “1ffa”, “6e8”, “1972”, “90”, “0” come up as single lines on the response as I’m reading it in. Here’s how I create and read the response.

    String hostname = "server";
    SocketFactory socketFactory = SSLSocketFactory.getDefault();
    Socket socket = new Socket(hostname, 8080);
   // Create streams to securely send and receive data to the server
    InputStream in = socket.getInputStream();
    OutputStream out = socket.getOutputStream();
    PrintWriter writer = new PrintWriter(out);
    writer.println("POST /handlerServlet http/1.1");
    writer.println("Host: " + hostname);
    String parameters="params=" + URLEncoder.encode("paramsToEncode", "UTF-8"); 
    writer.println("Content-Length: " + parameters.length());
    writer.println("Content-Type: application/x-www-form-urlencoded");
    writer.println("Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7");
    writer.println("Keep-Alive: 115");
    writer.println("Connection: keep-alive");
    writer.println("\r\n" + parameters + "\r\n");
    writer.flush();
    // Read from in and write to out...
    String input = "";
    BufferedReader reader = new BufferedReader(new InputStreamReader(in, "UTF-8"));
    StringBuffer result = new StringBuffer();
    boolean startWriting = false;
    FileOutputStream outStream1 = new FileOutputStream(new File("/file1.txt"));
    Writer outWriter = new OutputStreamWriter(outStream1, "UTF-8");

    while ( (input = reader.readLine()) != null) {
    result.append(input);
    outWriter.write(input + "\n");
    result.append('\n');
    }
    System.out.println(result.toString());
    outWriter.close();
    // Close the socket
    in.close();

Does any one have any clue as to why I would see characters like this?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="http://server:8080/HW/YX+JpCEnNDe5B87CCyFj5KR7z9rqlwRK77aMm/44221331.htm">

1ffa

<meta http-equiv="Content-Type"  content="text/html; charset=ISO-8859-1">
<title></title>
</head>
<body bgcolor="#ffffff">
<!-- Created by Oracle Reports 21:14 Tue Jun 29 09:14:32 PM, 2010 -->
....
<tr valign=top>
  <td height=10></td>
  <td width=80 colspan=3 align=center><font size=2 face="helvetica">V002A050001</font></td>
  <
1ffa
td></td>

as you can see, having these characters appear in random locations can cause some hecktick behavior on the HTML code.

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-05-15T12:57:30+00:00Added an answer on May 15, 2026 at 12:57 pm

    Do you get a header in your response that says something like this?

    Transfer-Encoding: chunked
    

    In this case, it’s most likely due to HTTP Chunked Transfer Encoding. It’s normal.

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

Sidebar

Ask A Question

Stats

  • Questions 543k
  • Answers 543k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I have some problem Use option: 'requestScheme' => Zend_Oauth::REQUEST_SCHEME_QUERYSTRING in… May 17, 2026 at 6:26 am
  • Editorial Team
    Editorial Team added an answer You might be interested in Boost.Bimap. May 17, 2026 at 6:26 am
  • Editorial Team
    Editorial Team added an answer Fixed it guys, turns out that last migration I did… May 17, 2026 at 6:26 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I'm using sockets to read all incoming SMS : `smsAddr.SetTextMatch(KNullDesC8);` The ones that belong
I'm writing a client-server app using BSD sockets. It needs to run in the
I would like to create a server using .NET and Java client (Android application).
When I create a socket using accept() and make a FILE out of it
I have some experience making multiplayer turn-based games using sockets, but I've never attempted
I have three applications that talk to each other using sockets. They can all
When using the Net.Sockets.TcpListener, what is the best way to handle incoming connections (.AcceptSocket)
I'm using C#.Net and the Socket class from the System.Net.Sockets namespace. I'm using the
Hey gang. I have just written a client and server in C++ using sys/socket.
Using C / C++ socket programming, and the read(socket, buffer, BUFSIZE) method. What exactly

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.