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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T14:59:06+00:00 2026-05-31T14:59:06+00:00

I am currently not receiving the last object from my object stream until another

  • 0

I am currently not receiving the last object from my object stream until another set of data is sent from the server. The objects sent have either a 1,2 or 3 int to state whether they are the first middle or last packets. I have sent these objects to an array and analysed this in the debugger, it shows that the last packet does not come through until the first one is sent again.

This is the server code:

public void telleveryone(Object message){
    Iterator it = clientOutputStream.iterator();
    while(it.hasNext()){
        try{

            ObjectOutputStream everyone = (ObjectOutputStream)it.next();
            everyone.writeObject(message);
            everyone.flush();

        }catch(Exception ex){
            ex.printStackTrace();
        }
    }

}

This is the receiving code on the client:

public void run() {

    try{
        sock = new Socket("10.42.34.46", 1337);

        InputStream is = sock.getInputStream();

        ois = new ObjectInputStream(new BufferedInputStream(is));

        OutputStream os = sock.getOutputStream();

        oops = new ObjectOutputStream(os);

        while(true){

                serverDraw =   (com.DrawTastic.Drawring) ois.readObject();

                test.add(serverDraw);

        }


    }catch(IOException ex){
        ex.printStackTrace();
    } catch (ClassNotFoundException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }


}
  • 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-31T14:59:07+00:00Added an answer on May 31, 2026 at 2:59 pm

    You need to flush the header:

    callers may wish to flush the stream immediately to ensure that
    constructors for receiving ObjectInputStreams will not block when
    reading the header

    oops = new ObjectOutputStream(os);
    oops.flush();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have to leave in a DataTable only records with dates currently not present
I do not currently have this issue , but you never know, and thought
I'm maintaining an in-house ORM written in C#, and it currently does not have
I am currently using CVS (not my choice) and have several branches. I'm trying
Currently In my embedded linux I can not open multiple ALSA sound stream. What
Currently in our enterprise we have a situation that i think it's not very
I'm receiving data feeds from a number of different servers across the country, and
I currently have a TFS 2010 Server running on SERVER-1. On my client (MY-CLIENT)
Currently I have an application that receives an uploaded file from my web application.
I'm receiving a bunch of values from my server for various dates with each

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.