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 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

Related Questions

I need to create 1000 server sockets using Java. Somewhere between creating 600 and
How does one create a POST request using TCPSocket in Ruby? Is there a
I am using TCP/IP sockets to create a client and server applicaton. Originally I
i am using raw sockets to create my own socket. i need to set
I'm using super-simple synchronous C# Sockets for an assignment. The assignment is to create
Can we create a Silverlight Socket Server ONLY using SILVERLIGHT and XML's (NO WCF
I'm writing a multi-threaded server using boost::asio (for sockets), boost::thread (for threading), libconfig++ (for
I'm planning to study sockets using C language, and I want to create a
I'm using Express.js to create a server to which I can connect using web
I'm using sockets in c++ on linux to connect to a server using connect(),

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.