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
PIN: N/A
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
port.close

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
Offline  
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: 10.010219
PIN: No Pin just a Tack
Carrier: at&t
Posts: 8,272
Post Thanks: 42
Thanked 575 Times in 570 Posts
Default

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


9810 BES
Z10 on BES
9700 BIS
Offline  
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





Copyright 2004-2014 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.