Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Archived:Using Bluetooth serial port in MIDlets on S80 and S60 2nd Edition (Known Issue)

From Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

The article is believed to be still valid for the original topic scope.

Article Metadata
Tested with
Devices(s): Nokia 6600 v.4.09.1
Nokia 6620, Nokia 6260, Nokia 6670, Nokia 7610
Nokia 9300, Nokia 9500
Created: User:Technical writer 1 (22 Dec 2004)
Last edited: hamishwillee (23 Jul 2013)



Reading incoming stream does not work properly in certain Nokia S60 and Series 80 devices.


When the Bluetooth Serial Port Profile (RFCOMM protocol) is used, reading incoming stream is sometimes interrupted with IOException. The read() method of the InputStream class may throw an IOException if the other end has closed the stream while the InputStream is still reading it.
Another issue is that the InputStream cannot use a bigger byte array than 512 bytes when reading stream. A bigger byte array may crash the MIDlet.

How to reproduce

Run, for example, the BtsppEcho example application.


Solution to the IOException issue: Ensure that the has finished before closing the output stream in the other end.
Solution to the stream size issue: Do not use a bigger byte array than 512 bytes.  Read the input stream in a loop or keep the whole length of the stream under 512 bytes.
Generic workaround to both issues: Use L2CAP connection instead of SPP (RFCOMM), if appropriate. This is feasible when you have access to the L2CAP protocol in both ends of your application (for example, connections between two devices).

This page was last modified on 23 July 2013, at 07:18.
36 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.


Thank you!

We appreciate your feedback.