写入StreamSocket时蓝牙背景崩溃 [英] Bluetooth Background crashes while writing into StreamSocket

查看:79
本文介绍了写入StreamSocket时蓝牙背景崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在开发一个应用程序,它涉及蓝牙设备之间的通信,以控制我的音乐电话。该应用程序包括两个后台任务; (1)蓝牙和(2)背景媒体播放器。这两个任务在后台都能很好地沟通,但是,经过一段时间后,我注意到了蓝牙背景崩溃,我松开了蓝牙连接。我缩小了问题的范围,发现在应用程序向蓝牙接收器发送大约170个数据包之后发生了蓝牙连接问题。每个数据包
长约30个字节。看起来输出缓冲区以某种方式变满。我发送了太多数据包,我已经多次重现了这个问题。  这是我发送数据的函数:



public async Task WriteMessage(BluetoothMessage message)

解决方案

检查:

WP 8.1中的蓝牙后台任务

http://migeel.sk/blog/2014/07/05/bluetooth-background-tasks-in-wp-8-1/


Hi,

I'm developing an app which involves the communication between a Bluetooth device to control the music on my phone. The app includes two background task; (1) Bluetooth and (2) Background media player. Both tasks communicate well in the background, However, I noticed after some time, the Bluetooth background crashes and I loose the Bluetooth connection. I narrowed down the problem and I found the Bluetooth connection issue happens after sending around 170 packets from by app to the Bluetooth receiver. Each packet is around 30 bytes long. It looks like the output buffer gets full somehow. I've reproduced the issue several time with sending too many packets.  Here is my function that sends the data:

public async Task WriteMessage(BluetoothMessage message)

解决方案

Check this:
Bluetooth background tasks in WP 8.1
http://migeel.sk/blog/2014/07/05/bluetooth-background-tasks-in-wp-8-1/


这篇关于写入StreamSocket时蓝牙背景崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆