.NET Components for Mobility

how to send msg using socket when bluetooth device connected with pc

Last post 08-13-2008 9:14 AM by alanjmcf. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 08-10-2008 11:16 PM

    how to send msg using socket when bluetooth device connected with pc

    this is my code :

    bc = new BluetoothClient();

     bc.Client.Connect(new BluetoothEndPoint(btaddress, service));

     byte[ msg = stringTobyte("12345");

     bc.Client.Send(msg, 0, 5, SocketFlags.None);

    It can't send msg, what's wrong?  who can help me out ?

    thank you very much

  • 08-13-2008 9:14 AM In reply to

    Re: how to send msg using socket when bluetooth device connected with pc

    See the user's guide (either in the release or at http://32feet.net/files/folders/documents/entry5846.aspx), there's a short sample there.

    You want to remove the .Client bits, its not a good idea to access the internal bits of the classes.  So just call bc.Connect, and access the connection through a stream e.g.

       NetworkStream peer = bc.GetStream();
       bc.Write(msg, 0, msg.Length);

    Alan J. McFarlane
    http://www.alanjmcf.me.uk/
    Please follow-up in the newsgroup for the benefit of all.
    Have I helped? Consider visiting my Amazon wishlist, see my homepage.
Page 1 of 1 (2 items)
Copyright © 2001-2008 In The Hand Ltd. All rights reserved. Terms of Use and Privacy Policy.