Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #8499

Re: Buffered reading seems to corrupt data stream

From markspace <-@.>
Newsgroups comp.lang.java.programmer
Subject Re: Buffered reading seems to corrupt data stream
Date 2011-10-03 11:33 -0700
Organization A noiseless patient Spider
Message-ID <j6cv50$2fk$2@dont-email.me> (permalink)
References <y4Cdne-uvN4kUBTTnZ2dnUVZ_hWdnZ2d@westnet.com.au>

Show all headers | View raw


On 10/3/2011 7:58 AM, Qu0ll wrote:
> I am trying to repeatedly send a byte array from a server to a client
> where both the writing and the reading is done in a buffered manner with
> the following code on the server:
>
> DataOutputStream dos = new DataOutputStream(os);
> dos.writeInt(bytes.length);
> dos.write(bytes);
> dos.flush();


I got to repeat the request for an SSCCE.  The code above is certainly 
not where the problem is.  The problems is certainly in some other area 
which you haven't shown us.

As a suggestion, scan the input above before you write it.  You'll 
certainly find the same values going in as you are reading back out. 
Then trace the path up the input side to determine what is actually 
writing that data in the the array "bytes".

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Buffered reading seems to corrupt data stream "Qu0ll" <Qu0llSixFour@gmail.com> - 2011-10-04 01:58 +1100
  Re: Buffered reading seems to corrupt data stream "Qu0ll" <Qu0llSixFour@gmail.com> - 2011-10-04 02:26 +1100
    Re: Buffered reading seems to corrupt data stream Ronny Schütz <usenet.r96@gishpuppy.com> - 2011-10-03 17:54 +0200
      Re: Buffered reading seems to corrupt data stream "Qu0ll" <Qu0llSixFour@gmail.com> - 2011-10-04 07:07 +1100
        Re: Buffered reading seems to corrupt data stream Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2011-10-03 13:18 -0700
      Re: Buffered reading seems to corrupt data stream "Qu0ll" <Qu0llSixFour@gmail.com> - 2011-10-04 10:54 +1100
    Re: Buffered reading seems to corrupt data stream Roedy Green <see_website@mindprod.com.invalid> - 2011-10-03 11:46 -0700
  Re: Buffered reading seems to corrupt data stream Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2011-10-03 08:44 -0700
  Re: Buffered reading seems to corrupt data stream markspace <-@.> - 2011-10-03 11:33 -0700
    Re: Buffered reading seems to corrupt data stream Lew <lewbloch@gmail.com> - 2011-10-04 08:48 -0700
      Re: Buffered reading seems to corrupt data stream Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2011-10-04 09:07 -0700
        Re: Buffered reading seems to corrupt data stream Lew <lewbloch@gmail.com> - 2011-10-04 12:06 -0700

csiph-web