I have read that pairing is a must before communicating anything over bluetooth, but I want to know,
Can I create an application which would read a text which is broadcasted by another bluetooth App without being paired.
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.
Example: there is createInsecureRfcommSocketToServiceRecord() & listenUsingInsecureRfcommWithServiceRecord() in android but aren't there such in C# for windows?
Thanks
is creating an application running on windows 7 PCs, which create instant Bluetooth network for peer to peer file transfer and chat
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.
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. :-,)
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.
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.
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... :-)
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();
and on the other:
....
var wtr = new StreamReader(peerStream);
var line = wtr.ReadLine();
MessageBox.Show(line);
There's code in the BluetoothChat which pretty much does something like that.
Alan
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With