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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T09:20:12+00:00 2026-05-24T09:20:12+00:00

I debugged the program and observed that it is stopped when it wants to

  • 0

I debugged the program and observed that it is stopped when it wants to get input stream from socket:

public Chat(Socket s) throws IOException {
        input = new ObjectInputStream(s.getInputStream()); // stopped here 
        output = new ObjectOutputStream(s.getOutputStream());
        initComponents();
    }

I have closed the open streams and the socket before calling above constructor here:

Socket socket = listeningSocket.accept();
disconnect();
Chat c = new Chat(socket);

and here is the disconnect method:

private void disconnect() throws IOException {
        input.close();
        output.close();
        client.close();
    }

input, output and client are initiated here:

    client = new Socket(chatServer, chatPort);
    input = new ObjectInputStream(client.getInputStream());
    output = new ObjectOutputStream(client.getOutputStream());

this is the stack trace when the program is suspended:

Thread [main] (Suspended)   
    SocketInputStream.socketRead0(FileDescriptor, byte[], int, int, int) line: not available [native method]    
    SocketInputStream.read(byte[], int, int) line: 146  
    ObjectInputStream$PeekInputStream.read(byte[], int, int) line: 2282 
    ObjectInputStream$PeekInputStream.readFully(byte[], int, int) line: 2295    
    ObjectInputStream$BlockDataInputStream.readShort() line: 2766   
    ObjectInputStream.readStreamHeader() line: 797  
    ObjectInputStream.<init>(InputStream) line: 297 
    Chat.<init>(Socket) line: 20    
    Client$5.run() line: 310    
    Client.clientListen() line: 320 
    Client.access$7(Client) line: 302   
    Client$6.run() line: 350    
    Client.main(String[]) line: 352 

please help
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-24T09:20:12+00:00Added an answer on May 24, 2026 at 9:20 am

    From ObjectInputStream’s constructor‘s documentation:

    This constructor will block until the corresponding ObjectOutputStream
    has written and flushed the header.

    Is anything being written to the socket from the other end? Are you flushing the stream from the other end?

    The ObjectOutputStream’s constructor has documentation saying that users may wish to flush to the stream so that inputstreams don’t block.

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

Sidebar

Related Questions

Is it possible to control gdb from the debugged program? I'm hoping for a
I have a program that loads lines from a user file, then selects the
I've debugged my program and the arrays seem to be allocated well. However for
I'm getting an Error from Debugger: Error launching remote program: security policy error when
Is there a SSCLI equivalent for .Net Framework 3.5? Something that can be debugged
I need to solve a large, sparse system of linear equations from a program
Is there a way to send command line arguments to a program being debugged
I'm trying to write my first Perl program. If you think that Perl is
I have an application that is sensitive to the directory it gets invoked from
A WinForms form that includes a UserControl throws an exception when I attempt to

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.