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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T01:31:03+00:00 2026-06-16T01:31:03+00:00

I have a server that times out after 45 seconds if it hasn’t received

  • 0

I have a server that times out after 45 seconds if it hasn’t received a full request and closes the connection. I connect to this server through a Socket and write my request to the socket’s OutputStream.

Socket socket = new Socket("myhost", myPort);
PrintWriter out = new PrintWriter(socket.getOutputStream());
out.write(properRequestMessage);
out.flush();

I’m assuming here that my request is good (follows my protocol). The server is supposed to respond with a file. I try to read from the socket inputstream:

BufferedReader response = new BufferedReader(new InputStreamReader(socket.getInputStream()));

String in;

while((in = response.readLine()) != null) {
    System.out.println(in);
}

The readLine() blocks here and I think it is because my server thinks my request isn’t properly terminated and is therefore waiting for more.

Now, if 45 seconds pass and my server times out, will the readLine() unblock or wait for some Socket default timeout time?

  • 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-06-16T01:31:04+00:00Added an answer on June 16, 2026 at 1:31 am

    That depends on what the server does when it times out. If it closes the connection you will see that. If it just logs a message, you might not see anything.

    There is no default read timeout. Your readLine() can wait forever.

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

Sidebar

Related Questions

I have a server that communicates to a lot of devices (>1000). Each connection
I have a jetty server which is configured to expire requests after 30 seconds,
I have an SP that takes 10 seconds to run about 10 times (about
I have a server that runs on Solaris 10, whenever I go to the
I have a server that runs different websites on different ports. All of them
I have a server that is serving files to several windows clients using the
I have a server that returns JSON in the following format: [{Name: Student1, Email:
I have a server that is running Ubuntu Linux Server Edition. I once had
I have a server that has several virtual machines running on it. I'm trying
I have a server that connects to multiple clients using TCP/IP connections, using C

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.