locked
sending a string data to mobile from pc through bluetooth RRS feed

  • Question

  • hello every one
    I want to develop a project so that when i send a string data to mobile through Bluetooth . It should show a alert on the mobile. so i have a code which receives or uploads file to mobile n it s working . but now i want to send a string data . Even i saw the website InTheHand.com i didn't got the solution . So can somebody know how to send string data to mobile with an alert.

     

    private void button1_Click(object sender, EventArgs e)
           {
               lis = new BluetoothListener(BluetoothService.ObexObjectPush);
              // lis=new BluetoothListener (
               byte[] buffer = new byte[2048];
     
               int bytesRead = 0;
               lis.Start();
     
    
               BluetoothClient client = lis.AcceptBluetoothClient();
               if (client.Connected)
               {
    StreamWriter write = new StreamWriter(client.GetStream());
                    write.WriteLine("Hello");
                    write.Flush();
                    write.Close();
                }
     
    
     
            }
    
     

     
    But its not working . it shows connection was Abort while connecting at the mobile side

     

    • Moved by edhickey Tuesday, September 6, 2011 4:39 PM (From:.NET 3.0/3.5 Windows Workflow Foundation)
    Monday, September 5, 2011 10:18 AM

Answers

  • Hello,

     

    First, you can use try-catch block to get the error message, when your application failed.

     

    On the other hand, you can follow the sample codes in Windows Mobile SDK.Bluetooth Game

     

    At last, this error maybe cause by the third-part library, I suggest you to open a new thread in In the hand forum.

     

    I hope my suggestions can help you to solve this problem.

     

    Best regards,

    Jesse


    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Proposed as answer by Jesse Jiang Friday, September 9, 2011 6:42 AM
    • Marked as answer by Jesse Jiang Tuesday, September 13, 2011 9:42 AM
    • Unmarked as answer by Arun1985 Saturday, September 17, 2011 7:41 AM
    • Marked as answer by Jesse Jiang Tuesday, October 4, 2011 3:11 AM
    Wednesday, September 7, 2011 6:41 AM

All replies

  • Hello,

     

    First, you can use try-catch block to get the error message, when your application failed.

     

    On the other hand, you can follow the sample codes in Windows Mobile SDK.Bluetooth Game

     

    At last, this error maybe cause by the third-part library, I suggest you to open a new thread in In the hand forum.

     

    I hope my suggestions can help you to solve this problem.

     

    Best regards,

    Jesse


    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Proposed as answer by Jesse Jiang Friday, September 9, 2011 6:42 AM
    • Marked as answer by Jesse Jiang Tuesday, September 13, 2011 9:42 AM
    • Unmarked as answer by Arun1985 Saturday, September 17, 2011 7:41 AM
    • Marked as answer by Jesse Jiang Tuesday, October 4, 2011 3:11 AM
    Wednesday, September 7, 2011 6:41 AM
  • Hello,

     

    Would you mind letting me know the result of the suggestions? If you need further assistance, feel free to let me know. I will be more than happy to be of assistance.

     

    Best regards,

    Jesse


    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, September 21, 2011 8:00 AM