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 530k
  • Answers 530k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

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

    • 7 Answers
  • Editorial Team

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

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Use an OAuth library such as: http://github.com/jdg/oauthconsumer http://github.com/bengottlieb/Twitter-OAuth-iPhone There are… May 16, 2026 at 11:33 pm
  • Editorial Team
    Editorial Team added an answer System.Diagnostics.Stopwatch is your best bet. However, the exact accuracy will… May 16, 2026 at 11:33 pm
  • Editorial Team
    Editorial Team added an answer C++ does not know what a project is. C++ knows… May 16, 2026 at 11:33 pm

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

How does one create a POST request using TCPSocket in Ruby? Is there a
I'm using sockets in c++ on linux to connect to a server using connect(),
I want to create a chat room using HTML5 web sockets, but am pretty
Hey, so I'm trying to build a simple lan game using sockets (not tcpclient
I have to create an sample code that connect to a socket server, and
I'm trying to build a Python application using pyGTK, treads, and sockets. I'm having
I want to create a server and client that sends and receives UDP packets
Disclaimer: please do not bother reading this long post unless you are an embedded
I know there are many posts about using CRON to run a php file.
I'm trying to create something similar as this code found at the boost.asio examples.

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.