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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:51:07+00:00 2026-05-26T02:51:07+00:00

I have a bufferedreader and for some reason it wont read the text from

  • 0

I have a bufferedreader and for some reason it wont read the text from the print stream I am sending from my client. This is the point at which it fails every time the line = in.readline

Also I have checked and the server is connected.

This is the error

java.net.SocketException: Connection reset
    at java.net.SocketInputStream.read(SocketInputStream.java:168)
    at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:264)
    at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:306)
    at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:158)
    at java.io.InputStreamReader.read(InputStreamReader.java:167)
    at java.io.BufferedReader.fill(BufferedReader.java:136)
    at java.io.BufferedReader.readLine(BufferedReader.java:299)
    at java.io.BufferedReader.readLine(BufferedReader.java:362)
    at Server.ServerListener$getXML.run(ServerListener.java:82)
    at java.lang.Thread.run(Thread.java:662)

Thanks in advance

       BufferedReader in = new BufferedReader(new       InputStreamReader(server.getInputStream()));
            //PrintStream out = new PrintStream(server.getOutputStream());
            System.out.println("Start");
            //read the xml
           boolean connected = server.isConnected();
            System.out.println("xml: "+ connected);
            line = in.readLine();
            System.out.println("Postread");
            while ((line = in.readLine()) != null) {               
                System.out.println("while1");
                xml = xml + line;
                System.out.println("while2");
            }`
  • 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-26T02:51:07+00:00Added an answer on May 26, 2026 at 2:51 am

    isConnected() tells you whether your socket is connected to the connection, not whether the connection is still connected to the peer. Obviously you aren’t still connected at all. ‘Connection reset’ has several possible causes: you wrote to a connection that had already been closed by the other end (application protocol error); the other end aborted the connection; the local TCP stack has encountered network errors sending and has given up. First of those is then most likely suspect. And don’t use PrintStreams/Writers across the network, as they swallow exceptions you need to know about. And you are throwing away a line of data with the first readLine() call: remove it and just leave the one in the loop.

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

Sidebar

Related Questions

I have this problem. I read with BufferedReader text from one system file, this
I need to write a simple terminal-based program that should, Read some text from
I have an application which gets some data from a remote database. I use
I have a simple java code which gets html text from the input url:
I have some code to read the lines from a file, I would like
I'm trying to read some text from an html file, modify it in a
I currently have 2 BufferedReader s initialized on the same text file. When I'm
I have this code: ServerSocket serverSideSocket = new ServerSocket(1234); serverSideSocket.accept(); BufferedReader in = new
Basically I have a script in Python that grabs the text from an open
I am trying to read in some sentences from a file that contains unicode

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.