Jump to content



Photo

WHILE loops and InputStreams

java

  • Please log in to reply
18 replies to this topic

#16 OP Original Poster

Original Poster

    Systems Developer

  • Tech Issues Solved: 1
  • Joined: 15-July 08
  • Location: my room
  • OS: windows 7/8, Kali, ubuntu, OSx 10.9
  • Phone: Android

Posted 07 December 2012 - 04:54

while ((read=in.read(buf, 0, 4096)) > 0) {


this is going good so far :D just one smmmallllll issue .... the code I have at the moment only works if the sending is within the while loop (which is fine) but its adding all the previous messages on to it :3 imma try flushing it but im pretty sure that will just clear everything except the last byte


#17 kjordan2001

kjordan2001

    Mystery Solver

  • Tech Issues Solved: 1
  • Joined: 27-May 02

Posted 07 December 2012 - 16:47

this is going good so far :D just one smmmallllll issue .... the code I have at the moment only works if the sending is within the while loop (which is fine) but its adding all the previous messages on to it :3 imma try flushing it but im pretty sure that will just clear everything except the last byte

It's not something like you're re-using the CharArrayWriter instance without calling reset() on it, is it?

#18 OP Original Poster

Original Poster

    Systems Developer

  • Tech Issues Solved: 1
  • Joined: 15-July 08
  • Location: my room
  • OS: windows 7/8, Kali, ubuntu, OSx 10.9
  • Phone: Android

Posted 07 December 2012 - 20:51

It's not something like you're re-using the CharArrayWriter instance without calling reset() on it, is it?


it might be O.o .... im not that knowledgeable on all these things yet ... I only know whatI have used and i have never used the reset xD last year all my work was mainly GUI and logic based rather then using all the libraries :p i will look into this reset function .... I tried nulling it so javas garbage collection would handle it but that messed things up

#19 OP Original Poster

Original Poster

    Systems Developer

  • Tech Issues Solved: 1
  • Joined: 15-July 08
  • Location: my room
  • OS: windows 7/8, Kali, ubuntu, OSx 10.9
  • Phone: Android

Posted 08 December 2012 - 00:26

It's not something like you're re-using the CharArrayWriter instance without calling reset() on it, is it?


ok reset and all that works BUT OMG 2bytes are being added somewhere and I dont know why or how ... it says on the sending side its 256...then on the recieving side when it goes to decrypt it... its apprently 258 ...