本文介绍了蓝牙发送/接收文本,而不使用C#2的Windows 7计算机配对的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已阅读,配对通信的蓝牙任何东西之前必须的,但我想知道,

I have read that pairing is a must before communicating anything over bluetooth, but I want to know,

我可以创建一个将读取文本这是一个应用程序
另一个蓝牙应用广播而不被配对。

由于我们可以看到周围的设备等蓝牙设备的名称。所以,我们不能我们的蓝牙无线电设定的状态,它会读取任何蓝牙boradcasting短信。

Because we can see the names of other bluetooth devices around a device. So can't we set our bluetooth radio to a state that it would read any bluetooth boradcasting text message.

例如:有 createInsecureRfcommSocketToServiceRecord()的&安培;的 listenUsingInsecureRfcommWithServiceRecord()的android系统,但不存在这样的在C#中的窗口?

Example: there is createInsecureRfcommSocketToServiceRecord() & listenUsingInsecureRfcommWithServiceRecord() in android but aren't there such in C# for windows?

感谢

是创建一个应用程序运行在Windows 7的PC,它创建即时蓝牙网络的点对点文件传输,聊天

is creating an application running on windows 7 PCs, which create instant Bluetooth network for peer to peer file transfer and chat

有一群人,每个人都有各自的计算机上这个应用程序,人们希望共享的文件,(可能是电子书,PDF或任何东西),其余。他将自己的网络网(或任何其他名称)在其应用程序的配置和其他人也提出了相同的名称上的每个应用程序。最后,每个用户都可以看到他们周围的其他蓝牙节点列表在他们的应用程序显示,配置为相同的网络名网。所以每个人都可以在同一网络中的文件发送到选择的节点。

There is a group of people, each has this app on each computer, one wants to share a file, (may be an eBook, PDF or anything) with the rest. He sets his network "net" ( or any other name) in his app configuration and others also put that same name on each app. Finally each user can see the list of other Bluetooth nodes around them in their apps display, configured to same network name "net". so each can send files to selected nodes in the same network.


  • 每个用户的开启蓝牙无线电的,然后的进入所需的网络名称的在随后的应用程序

  • 在电脑的每个应用程序将反复沟通,可达蓝牙设备,通过临时创建的连接(无配对或用户参与),检查他们的网络名称,并列出发现电脑有类似的网络名称

  • 然后,他们将分享这些名单在彼此之间,这样一台电脑知道他们的同一网络中的计算机,即使他们不在范围内直接。

  • 从一台计算机发送文件到一个或多个计算机通过算法解决的路径,甚至是发送聊天文本。

  • 所有这一切都将通过每个应用程序的时间之间建立简单的时间暂时蓝牙连接,而无需配对或认证,比网络名称等来实现。 (因为我不知道如何创建一个使用C#微微网,或如何创建蓝牙路由协议。

  • 没有其他安全的实现。

  • Each user only turns on the Bluetooth radio and then enters a desired Network name in then app
  • Each application on PCs will communicate iteratively to reachable Bluetooth devices, through temporarily created connections (without pairing or user involvement), check their network names and list discoverable PCs with similar network names
  • Then they will share these lists among each other, so one PC knows the computers in their same network even though they are not in range directly.
  • Send files from one computer to one or many computers through a path resolved by an algorithm, even send chat texts.
  • All of this is going to be achieved through simple temporarily Bluetooth connections established between each application time to time, which requires no pairing or authentication, other than the Network Name. ( Because I don't know how to create Piconets using C#, or how to create bluetooth routing protocols.
  • No other security is implemented.

请让我知道任何其他更好的设计或方式。非常感谢您阅读冗长的文字。还包括任何有用的code,可以帮助我实现以上。

Please let me know of any other better design or way. Thank you very much for reading the lengthy text. Also include any helpful code which can help me achieve the above.

推荐答案

我让数十每天未配对连接...我不知道这个传闻从何而来。 : - , - )

I make tens of un-paired connections every day... I don't know where this rumour comes from. :-,)

当你注意到在Android默认的是一个验证的连接 - 也许这就是谣言开始从?即使在那里,当你注意到,有办法如要求配对而不是要求的'连接listenUsingInsecureRfcommWithServiceRecord。

As you note on Android the default was for an authenticated connection -- maybe that's where the rumour started from? Even there, as you note, there are ways to request a 'pairing-not-required' connection e.g. listenUsingInsecureRfcommWithServiceRecord.

所以,在微软Windows上堆放一是通过套接字(Winsock的)使用蓝牙(RFCOMM)。通过的默认的这一方面做的的要求身份验证(配对),无加密 - 其实要求AUTH / ENC必须设置一个套接字选项。同样具有的Widcomm,你当你创建你想要的安全级别的连接指定,这可能是无。同样在Bluetopia,在同样的BlueZ在Linux上。

So, on the Microsoft stack on Windows one uses Bluetooth (RFCOMM) through a socket (winsock). By default that connection does not require authentication (pairing), nor encryption -- in fact to request auth/enc one must set a socket options. Similarly with Widcomm, you specify when you create the connection what security level you want, and that can be 'None'. Similarly on Bluetopia, similarly on BlueZ on Linux.

所以,如果你用我的图书馆,只要使用BluetoothClient和BluetoothListener做的设置 cli.Authenticate = TRUE 等: - )

So if you use my library 32feet.NET, just use BluetoothClient and BluetoothListener and do not set cli.Authenticate=true etc. :-)

什么是你的终极目标?我刚刚意识到,你问有关的另一个问题文件传输...: - )

What's your ultimate goal? I've just realised that you were asking about file-transfer in another question... :-)

反正于传输文本...在服务器端有code一样显示在:<一href=\"http://32feet.$c$cplex.com/wikipage?title=Bluetooth%20Server-side\">http://32feet.$c$cplex.com/wikipage?title=Bluetooth%20Server-side和客户端像:<一href=\"http://32feet.$c$cplex.com/wikipage?title=General%20Bluetooth%20Data%20Connections\">http://32feet.$c$cplex.com/wikipage?title=General%20Bluetooth%20Data%20Connections不知道如果你知道的TextWriter / -Reader sublclasses .NET的,反正在一边:

Anyway for transferring text... On the server-side have code like shown at: http://32feet.codeplex.com/wikipage?title=Bluetooth%20Server-side and on the client like: http://32feet.codeplex.com/wikipage?title=General%20Bluetooth%20Data%20Connections Don't know if you know TextWriter/-Reader sublclasses on .NET, anyway on one side:

....
var wtr = new StreamWriter(peerStream);
wtr.WriteLine("hello");
wtr.Flush();

和在另一

....
var wtr = new StreamReader(peerStream);
var line = wtr.ReadLine();
MessageBox.Show(line);

有一个在BluetoothChat code这pretty钱?的东西的那样。

阿伦

这篇关于蓝牙发送/接收文本,而不使用C#2的Windows 7计算机配对的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-19 14:31