Re: sending objects over sockets

Discussion in 'Java' started by Steve Horsley, Jun 27, 2003.

  1. On Fri, 27 Jun 2003 10:43:36 +0000, Jeff wrote:

    > Thank you very much - reset() worked. Can you recommend any good
    > reading that would cover this area in more detail? I searched the web,
    > read my references books, but didn't find the reset functionality.
    >
    > "Sudsy" <> wrote in message
    > news:...
    >> Jeff wrote:
    >> > I'm writing a server that sends an object to a client every 5
    >> > seconds,

    > but
    >> > have a problem.
    >> >
    >> > I am sending an object over a socket to another program, then
    >> > changing

    > the
    >> > values of the object variables after each transmission. But my

    > receiver's
    >> > read keeps returning the same values over and over. I am changing
    >> > the values in the sender before sending the object a second time. I
    >> > suspect that the changed object is received by the reader, but the
    >> > 1st object is never removed from the buffer so it's read repeatedly.
    >> > Is there a way

    > to
    >> > force a read deeper in the input buffer?
    >> >
    >> > On the sender, I use:
    >> >
    >> > os = new ObjectOutputStream(sock.getOutputStream());
    >> > writeObject(SerializedObject);
    >> >
    >> > On the receiver, I use:
    >> > is = new ObjectInputStream(sock.getInputStream()); result
    >> > = (SerializedObject) is.readObject();
    >> >
    >> > Thanks
    >> >
    >> >

    >> Common problem. ObjectOutputStream.reset() to clear memory. HTH



    You will be wanting the API documantation download from Sun.
    http://java.sun.com/j2se/1.4.1/download.html#docs

    You might find it useful to download the java tutorial as well. They are
    both big downloads, but worthwhile. The API docs are _essential_.

    Steve
    Steve Horsley, Jun 27, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Steve Horsley

    Re: sending objects over sockets

    Steve Horsley, Jun 27, 2003, in forum: Java
    Replies:
    0
    Views:
    1,138
    Steve Horsley
    Jun 27, 2003
  2. Knute Johnson

    Re: sending objects over sockets

    Knute Johnson, Jun 27, 2003, in forum: Java
    Replies:
    5
    Views:
    3,189
    Steve Horsley
    Jun 28, 2003
  3. Gilles Dubochet

    Re: Sending bytes and string over sockets

    Gilles Dubochet, Aug 26, 2003, in forum: Java
    Replies:
    0
    Views:
    445
    Gilles Dubochet
    Aug 26, 2003
  4. Steve Horsley
    Replies:
    4
    Views:
    1,414
    Jon A. Cruz
    Aug 29, 2003
  5. Don
    Replies:
    4
    Views:
    1,433
    Roedy Green
    Oct 26, 2003
Loading...

Share This Page