Re: sending objects over sockets
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" <email@example.com> wrote in message
>> Jeff wrote:
>> > I'm writing a server that sends an object to a client every 5
>> > seconds,
>> > have a problem.
>> > I am sending an object over a socket to another program, then
>> > changing
>> > values of the object variables after each transmission. But my
>> > 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
>> > 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.
You might find it useful to download the java tutorial as well. They are
both big downloads, but worthwhile. The API docs are _essential_.
|All times are GMT. The time now is 01:39 PM.|
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.