Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 29
Registered: ‎06-25-2009
My Device: Not Specified

Bluetooth JSR82 OBEX pull -- premature EOF's and failure past EOF

Hello.

When doing an OBEX pull, I'm having the following problems:

- The sender is not properly setting the HeaderSet.Length header. This means that getting this value or using Operation.getLength will both fail

- I'm reading a close-format binary stream where I cannot get the length from the begining of the file

 

Reading until EOF exception does work -- however:

- I'm getting premature EOF's -- calling all forms of read() on the op.get(Data)InputStream will result in spurious -1's (EOF's) being return.

Continuing to read past these values will return more valid data.

- Reading until the (caught and handled) EOF exception, while the resultant data is valid, causes an immediate failure of the transfer, causing the file to stay on the source device. This failure happens at the time of the read, even before the onPut handler returns  

OBEX_HTTP_OK.  This means that that the JSR82 API is aborting the join of my handler, detaching and returning an error, even before my handler completes. (I can also tell be setting up remote debugging and breakpointing on the EOF exception-handler - the xfer has already failed by this point, as reported by the sending device.) 

- As a test, I can try a send, fail but mark the file size, then send again using the cached size and it does work. (I have to send everything twice.)

- Note that for payloads less than 4039 bytes, things seems to work ok if I read .available() bytes. (This is the value that the DataInputStream .available() will max out at - probably a internal BT/DAS buffer size.) I know that .available() only returns what is avaialble w/o blocking, but again, if I read up to EOF, then the xfer fails.

- .available() is not supported on the plain inputStream, and reading past EOF (skipping the spurious EOF's) has the same problem.

 

The following links show others seeing similar behavior on other platforms - at least the premature EOF issue (but not the failure past EOF issue):

 

// http://wiki.forum.nokia.com/index.php/Premature_EOF_indication_while_reading_from_OBEX/Bluetooth_sta...

// http://markmail.org/message/lur6hohjgjc75wcf

// http://www.google.com/search?hl=en&q=obex+EOF&aq=f&oq=&aqi=

 

thanks for any help

New Contributor
Posts: 2
Registered: ‎08-14-2011
My Device: 9800
My Carrier: Student

Re: Bluetooth JSR82 OBEX pull -- premature EOF's and failure past EOF

I have the same problem on Bold9700. Does somebody found the solution?