You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geronimo.apache.org by John Woolsey <jw...@activation.net> on 2004/09/01 04:13:50 UTC
Socket Fun
I am working on my RMI implementation and I was using the
ObjectOutputStream. I made a function serialize that I used to find the
length of the outbound data. Then I wrote the same object to a socket.
The sizes where different ?!? Anyone have any idea why?
- thanx - JAW
Re: Socket Fun
Posted by John Woolsey <jw...@activation.net>.
Good idea but I am using different ObjectOutputStreams. The first one is
to a byte array and the other is to a Socket Stream. The difference is 4
bytes 179 for the socket and 174. I am going to guess it is a length
variable that is added to the byte array stream. I have gone to
completely serializing outside the socket stream which works, but I
thought the difference was interesting and worth bringing up.
- bfn - JAW
adam wrote:
> Referencing by ObjectOutputStream. The second time you serialize the
> object out over the stream, ObjectOutputStream replaces it with a
> reference back to the one it just sent. In one of the older JVMs,
> this kept things that were serialized from being garbage collected,
> although that's been fixed now.
>
> Adam
>
> John Woolsey wrote:
>
>> I am working on my RMI implementation and I was using the
>> ObjectOutputStream. I made a function serialize that I used to find
>> the length of the outbound data. Then I wrote the same object to a
>> socket. The sizes where different ?!? Anyone have any idea why?
>>
>>
>> - thanx - JAW
>>
>
>
Re: Socket Fun
Posted by adam <ad...@earthlink.net>.
Referencing by ObjectOutputStream. The second time you serialize the
object out over the stream, ObjectOutputStream replaces it with a
reference back to the one it just sent. In one of the older JVMs, this
kept things that were serialized from being garbage collected, although
that's been fixed now.
Adam
John Woolsey wrote:
> I am working on my RMI implementation and I was using the
> ObjectOutputStream. I made a function serialize that I used to find
> the length of the outbound data. Then I wrote the same object to a
> socket. The sizes where different ?!? Anyone have any idea why?
>
>
> - thanx - JAW
>