gpt4 book ai didi

c# - 32feet .NET api 拒绝连接 "The requested address is not valid in its context"

转载 作者:行者123 更新时间:2023-11-30 17:37:55 27 4
gpt4 key购买 nike

我已经尝试解决这个问题一个小时了,这让我很头疼。我想做的就是使用示例 on this page 将蓝牙设备连接到我的应用程序.调用 .Connect 函数时,会出现 SocketException,提示“请求的地址在其上下文中无效”。

我确定我正在配对的设备的地址是正确的;我什至发现了设备并使用了其中一个找到的设备的地址,但我仍然遇到同样的错误。我已经尝试了 BluetoothService.SerialPort 和 Guid 的 MyConsts 类示例,但都引发了相同的错误。

我使用的代码在这里:

BluetoothAddress addr = BluetoothAddress.Parse("78A2A0FC0BB1");
Guid serviceClass;
serviceClass = BluetoothService.SerialPort;
// - or - etc
// serviceClass = MyConsts.MyServiceUuid
//
var ep = new BluetoothEndPoint(addr, serviceClass);
var cli = new BluetoothClient();
cli.Connect(ep);
Stream peerStream = cli.GetStream();

我也在使用 Visual Studio 2015。

最佳答案

根据文档,地址本身没有问题,但设备上运行的服务有问题。

https://32feet.codeplex.com/wikipage?title=Errors

No Service with given Service Class Id is running on the remote device

您确定您使用的设备正在运行 SerialPort 配置文件吗?

关于c# - 32feet .NET api 拒绝连接 "The requested address is not valid in its context",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37220988/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com