harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Zhang" <zhanghuang...@gmail.com>
Subject Re: RI's bug of Socket.getOutputStream().write(byte[]) ?
Date Sat, 24 Jun 2006 23:07:11 GMT
On 6/25/06, Tim Ellison <t.p.ellison@gmail.com> wrote:
>
> Thanks Florian, I need to go back and read Steven's more closely ;-) .
> I have no doubt you are correct, but have never seen a close overtake
> the data -- we should of course do it right.
>
> In such tests I would usually have a trivial protocol (i.e. sending a
> fixed-size length field first) so that the reader knows much to keep
> reading.


e.g, A wrote length = 100, then sent 100 bytes data,
B read the length field, then kept reading until 100 bytes data were
received.

But does it make sense? Still B maybe could hang on reading and never return
since A maybe didn't send out 100 bytes at all.
At least, RI hangs on in such case. Did I miss something?
Thanks!

Regards,
> Tim
>
> Florian Weimer wrote:
> > * Tim Ellison:
> >
> >> Maybe I'm misunderstanding the flow of the test here.
> >>
> >> here's how I read it...
> >>
> >> Server Side                    Client Side
> >> -----------                    -----------
> >> 'server' listens on 1234
> >>                                'channel' connects
> >> 'server' accepts
> >> 'out' sends 2xCAPACITY bytes
> >> 'out' flushes
> >> 'out' closes server end
> >>                                'channel' reads in loop until -1
> >>                                assert that channel gets 2xCAPACITY
> bytes
> >>
> >>
> >> Is that right?
> >
> > In this case, the effects of the close operation can overtake the
> > data.  You need the equivalent of shutdown(SHUT_WR) or
> > shutdown(SHUT_RDWR), or use some other form of synchronization.
> >
> > ---------------------------------------------------------------------
> > Terms of use : http://incubator.apache.org/harmony/mailing.html
> > To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
> > For additional commands, e-mail: harmony-dev-help@incubator.apache.org
> >
> >
>
> --
>
> Tim Ellison (t.p.ellison@gmail.com)
> IBM Java technology centre, UK.
>
> ---------------------------------------------------------------------
> Terms of use : http://incubator.apache.org/harmony/mailing.html
> To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
> For additional commands, e-mail: harmony-dev-help@incubator.apache.org
>
>


-- 
Andrew Zhang
China Software Development Lab, IBM

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message