I try to send an image over bluetooth to another device. This works mostly fine, but sometimes, I get a StreamCorruptedException: Wrong format: 0x27
on the receiving device. Anybody knows what this means? And how can I avoid that?
views:
39answers:
1
+1
A:
If you are using object input and output streams, you have to use the same ones for the life of the connection, or new ones for every object, at the same time, which is pretty hard to arrange. Same ones forever is simplest. This exception can arise when one end uses the same stream forever and the other end keeps creating new ones.
EJP
2010-08-01 10:35:44
Thanks. I thought it could be something like that. So I already checked for that, and I can't see any part of the code where I'm using a different stream. However is there any easy possiblity to check that easily? And is the number (0x27) meaning anything?
Roflcoptr
2010-08-01 11:26:54
0x27 isn't one of the serialization constants. Are you writing anything to the stream yourself other than via writeObject()? or reading from it other than via readObject()? or are you running two kinds of streams over the same socket, e.g. an ObjectOutputStream and a BufferedWriter, or conversely at the other end?
EJP
2010-08-02 00:31:49
I only use writeObject() and readObject(). But I noticed that the error occurs every time in combination with a java.IOException: Software caused connection abort
Roflcoptr
2010-08-02 09:25:09
That exception indicates a network problem. Have a look for an article I wrote at forums.sun.com with that message as the title.
EJP
2010-08-02 10:52:52