在C#中通过蓝牙从PC向Mobile发送短信

时间:2011-09-13 08:25:57

标签: c# bluetooth

我想通过蓝牙从PC向手机发送短信,我写了这段代码

private void send_text()
    { BluetoothRadio.PrimaryRadio.Mode = RadioMode.Discoverable;
        bluetoothClient = new BluetoothClient();

    for (int i = 0; i < sayi; i++)
    {                        
            InTheHand.Net.BluetoothAddress adres = this.adres_dizisi[i];
            try
            {
                bluetoothClient.Connect(new BluetoothEndPoint((BluetoothAddress)adres,service));
                // in this line error
                // socketexception was found   The requested address is not valid in its context InTheHand.Net.BluetoothEndPoint


                System.Net.Sockets.NetworkStream straem = bluetoothClient.GetStream();
                StreamWriter steramWriter = new StreamWriter(straem);

                steramWriter.WriteLine("! 0 200 200 210 1");

                // more stuff here.
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

我该怎么做才能解决这个问题?..请帮帮我..

0 个答案:

没有答案