BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 07-14-2010, 02:25 AM   #1
ogpriya
New Member
 
Join Date: Jul 2010
Model: 9000
PIN: N/A
Carrier: Airtel
Posts: 1
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
tsac
BlackBerry God
 
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: 10,030
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.
__________________
Z10 on BES
Z10 on BIS
Offline  
Closed Thread



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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


NEW FACTORY SEALED AB 1747-L541 SER B SLC 500 SLC 5/04 CPU PROCESSOR UNIT MODULE picture

NEW FACTORY SEALED AB 1747-L541 SER B SLC 500 SLC 5/04 CPU PROCESSOR UNIT MODULE

$311.33



Neo by Alphasmart Portable Word Processor Typewriter Keyboard Teacher- 1 Key picture

Neo by Alphasmart Portable Word Processor Typewriter Keyboard Teacher- 1 Key

$39.99



Unico 311-563 Processor picture

Unico 311-563 Processor

$649.00



New Factory Sealed AB 1747-L532 SER E SLC 500 5/03 CPU Processor Unit 1747L532 picture

New Factory Sealed AB 1747-L532 SER E SLC 500 5/03 CPU Processor Unit 1747L532

$320.76



Christie Phoenix Video Windowing Processor Presentation & Collaboration 500VWP picture

Christie Phoenix Video Windowing Processor Presentation & Collaboration 500VWP

$72.00



TSX47-411 TSXP47411 Telemecanique Processor picture

TSX47-411 TSXP47411 Telemecanique Processor

$125.00







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