This content has been marked as final. Show 2 replies
I think you have a mixed encoding problem
I am not familiar with that API but from what you have written,
readUTFBytes is expecting an UTF8 (3byte per character) stream
so that means if stream is "ABCD" in binary stream needs to equal to 3X8 which is of 24 bits per character and for all Four characters 24X4 = 96bits so total stream got to be 96 bits... but if "ABCD" stream is not in UTF8 encoding it will be lot smaller just 4X8 = 36.and thats where issue of able to read only partial data happens(I think, there are a lot of speculation, just putting my thoughs fo your to consider) so make sure stream is in utf8 ecoding, might fix the issue.
Thanks for the feedback. Unfortunately, the data is coming from a server I didn't write (OpenFire chat server) so it may be tricky for me to determine exactly how the stream is encoded. It is worth noting that if I use an older XIFF class which uses XMLSocket instead of Socket, it reads the response just fine ... so I don't think there is anything really wierd going on in the stream ... but it's hard to say anything for sure. I am using the old connection class for now as a workaround, but I'd like to figure out why the new one isn't working ... unfortunately, its open source and the authors are providing next to non-existent support so far ... so I thought I'd try to fix it myself just like I did the last dozen bugs I found. :)