Windows Phone 8 - Bluetooth Socket Connection

2

I have to communicate with a bluetooth device and read the data that is sent from that device.

I am communicating using a socket connection , the first time i connect it works properly , I am able to receive the data.

Next time when i connect to other device who's bluetooth is off i get the proper exception "A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. (Exception from HRESULT: 0x8007274C)."

And then when i again try to connect to the first device through which i want to read the data i get an exception saying "Only one usage of each socket address (protocol/network address/port) is normally permitted. (Exception from HRESULT: 0x80072740)"

this is the part of code i am using to connect

socket.Dispose();
socket = null;
socket = new StreamSocket();
await socket.ConnectAsync(deviceHostName, "1");
dataReader = new DataReader(socket.InputStream);
dataReadWorker.RunWorkerAsync(); 

Could anyone just help me out with this.

c#
sockets
windows-phone-8
bluetooth
windows-phone
asked on Stack Overflow Apr 19, 2014 by Omkar Guhilot

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0