Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   Re: sending objects over sockets (http://www.velocityreviews.com/forums/t123755-re-sending-objects-over-sockets.html)

Steve Horsley 06-27-2003 01:51 PM

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" <bitbucket44@hotmail.com> wrote in message
> news:3EFBD085.9060509@hotmail.com...
>> 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


All times are GMT. The time now is 10:16 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.