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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:11:23+00:00 2026-06-11T22:11:23+00:00

i am having a very weird situation in my code which i dont understand

  • 0

i am having a very weird situation in my code which i dont understand i am sending an object lets say O through a socket then i am changing the value of a variable in the object and sending it again but the second time when i print it on the client side, i am getting the same values as in the 1st object.

client code:

 while(true){
             try{
             order=(Order)ois.readObject();

            System.out.println(order);

             }

server code:

public void sendOrder(Order o){
    try {
        out.writeObject(o);

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

main method:

Server_Socket ss=new Server_Socket();
    ss.sendOrder(o);
    o.add(r2);
    ss.sendOrder(o);

The value is definitely changing on the serverside before i send it, but i dont understand why on the client side its not showing that r2 added in the object.

  • 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-11T22:11:25+00:00Added an answer on June 11, 2026 at 10:11 pm

    The objects are being cached by the ObjectOutputStream. To prevent this, call ObjectOutputStream.reset() after each write. If you are sending simple objects that don’t contain other objects, use writeUnshared() instead of writeObject().

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

Sidebar

Related Questions

I am having a weird Situation with my DataConext. All My code is in
I'm having a very weird situation that is driving me nuts. I have a
I am having a very weird situation in VS 2012 RC VB.NET project targeting
I having a very weird problem for my asp project. My project can run
I'm having a very weird issue in IE6. If I set a div container
I am having a very weird problem that I've never had before when using
I'm having a very weird problem with a vector in my application. Details... I
i having a very weird problem now . I has separate 2 jquery js
I've been having some very weird problems. Yesterday I updated my master branch on
I'm getting a very weird issue with standard ASP.NET backend code, and the latest

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.