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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:34:28+00:00 2026-05-16T06:34:28+00:00

I want to send an array of double as an object via ObjectOutputStream that

  • 0

I want to send an array of double as an object via ObjectOutputStream that uses a socket for outputStream. In the receiving side I read repetitious objects all the same! Maybe the assignment of method readObject doesn’t perform it’s task.
I’m trying to update dobArray and write it to the socket output stream. dobArray is updated by another thread. It does it’s task well, because I tested it. here is my code:

sending side:

    objectStream = new ObjectOutputStream(dataFlow.getOutputStream());

    while(busy){
        try {
            // dobArray is updated in another thread
            objectStream.writeObject( dobArray);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

receiving side:

    objectInputStream = new ObjectInputStream(
            mainServer.dataFlow.getInputStream());
    while (busy){
        try {
            DobArray dobarray =
                (DobArray) objectInputStream.readObject()
            writeToFile(dobarray);
        } catch (IOException e) {
            e.printStackTrace();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
    }

regards
sajad

  • 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-16T06:34:28+00:00Added an answer on May 16, 2026 at 6:34 am

    ObjectOutputStream is buffered. If you don’t flush() the stream it can wait, buffered indefinitely.

    When you pass a reference to an object it passes the value of that object only once. After that it only passes an object tag. This prevents recursive objects being serialized endlessly. However, if you pass a mutable object, on the first copy is sent.

    Only way around this is to call reset(), but the simplest solution is to use writeUnshared() which sends the object every time.

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

Sidebar

Related Questions

I want to send an array constructed in javascript with the selected values of
I want so send every week an update by email. But Im afraid that
If I want to send mail not via SMTP, but rather via sendmail, is
i want to send a javascript array to php using jquery ajax. $.post(controllers/ajaxcalls/users.php, {
I want to send an Array with image paths and captions to a PHP
I have an iPhone app with an array of objects that I want to
I want to send array from php to jquery using json. the array in
I want to send this array: results = [1, 4, 5, 6] So, I'm
I'm writing a TCP client using boost::asio . I want to send an array
I want to send a byte array from a web service to a client

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.