BlackBerry Forums Support Community

Closed Thread
LinkBack Thread Tools
Old 07-14-2010, 02:25 AM   #1 (permalink)
New Member
Join Date: Jul 2010
Model: 9000
Carrier: Airtel
Posts: 1
Post Thanks: 0
Thanked 0 Times in 0 Posts
Question Bluetooth datasending issue

Please Login to Remove!

Hi Everyone,

I'm using bluetoothserialport to open a new serial port connection and bluetoothserialportlistener to receive the acknowledgments. I write my first packet (ex. 4KB) to the port, wait for the datasent acknowledgment from bluetoothserialportlistener.dataSent() and then continue writing my next packet (next 4KB). This process continues till I write all the data.

This works fine and the remote end receives the complete data if i do not close the port immediately.

But once, i receive datasent acknowledgment for the last packet i sent, if i issue port.close to close the serial port connection, the last packet i sent does not reach the remote end properly.

For ex, my complete packet size is 6625bytes. I split it into 2 4KB packets.
This is my log.
port.write - 4096
Datasent acknowledgemnt
port.write - 2529
Datasent acknowledgment

But in the receiving end the data it receives is as follows
received: 4096
received: 2002.

This behavior is consistent. If there is a delay in closing the port, everything works fine..
Does datasent does not mean the data is been sent to the remote end completely??

Any help would be appreciated.

Thanks in advance
Old 07-18-2010, 11:29 AM   #2 (permalink)
BlackBerry Mensa
tsac's Avatar
Join Date: Mar 2005
Location: Others run out when we run in
Model: Z10
OS: Cheerios
PIN: No Pin just a Tack
Carrier: at&t
Posts: 9,704
Post Thanks: 92
Thanked 825 Times in 794 Posts

You may be receiving a packet received acknowledgment but it may not have fully completed all the required packet delivery acknowledgements from the end device. Simply waiting for a small amount of time may be the only solution.

In case you like overload on information, here it is.

When transmitting BT data or data/voice packets an
unnumbered ARQ (Automatic Repeat Request) scheme is
used. Such packets are retransmitted until an
acknowledgement of successful reception is received, or a
timeout occurs. The acknowledgement (either positive or
negative) is piggy-backed onto the header of the return
packet. A missing acknowledgement (e.g. the return packet
was lost) is treated as a negative acknowledgement
In case of master-to-slave transmission, the return packet is
sent in the subsequent time slot. When the slave transmits
the return packet is received the next time the master
addresses the slave.
In order to distinguish the cases when a packet was
successfully received, but the acknowledgement was lost
and successful acknowledgement, a 1-bit sequencing
number is used. If a packet it resent, the sequence number
is held; this way the recipient will detect duplicate packets.
If the receive buffer fills up, a Bluetooth device may stop
the transmission by resetting the FLOW field in the return
packet. This xxx8220;stopxxx8221; signal does not affect control packets. If
the return packet is not received, a xxx8220;goxxx8221; signal is assumed.
If someone helps, tell them by clicking the Thanks button

Z10 on BES
Z10 on BIS
Closed Thread

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

1PC Brand New SMC solenoid valve VQ4201-5W-Q
1PC Brand New SMC solenoid valve VQ4201-5W-Q pictureNumatics 152SS600M000061 225-372B 24 VDC Solenoid Pneumatic Valve
Numatics 152SS600M000061 225-372B 24 VDC Solenoid Pneumatic Valve pictureWandfluh-Hydraulik AW32101a-S558 Hydraulic Solenoid Valve
Wandfluh-Hydraulik AW32101a-S558 Hydraulic Solenoid Valve pictureBaxter 01-1P2030-00101 Solenoid assembly ASCO
Baxter 01-1P2030-00101 Solenoid assembly ASCO picture

Copyright 2004-2016
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.