Send a file trough bluetooth in C# with 32Feet.NET

32feet Once again, another article about this little puppy called 32Feet.NET. In the previous article I show you how to download a file, now we will send a file to the remote device. Once again, proceed in two steps. First one, as in the previous article (https://istacee.wordpress.com/2013/02/22/download-a-file-through-bluetooth-in-c-with-32feet-net/) juste retrieve the BluetoothDeviceInfo object. And here’s the upload method 🙂

        public void SendFile(BluetoothDeviceInfo device, string fileToSend, string destinationPath)
        {
            // Build te OBEX uri and create an OBEX web request
            var obexUri = new Uri("obex://" + device.DeviceAddress + "/" + destinationPath);
            var request = new ObexWebRequest(obexUri);

            // Fill the request with the file data
            request.ReadFile(fileToSend);

            // Send the request to the targeted bluetooth device
            var response = request.GetResponse() as ObexWebResponse;
            response.Close();
        }

5 thoughts on “Send a file trough bluetooth in C# with 32Feet.NET

  1. Arun

    Can you please send a code for pairing of device (laptop and a hand held device) using 32feet library

    Reply
  2. José Carlos Coutinho

    My idea is: I create the program that will detect my partner’s pc via Bluetooth. This accepts communication (or I have direct communication, because it can be both ways) that has an image in a folder in the c: \ image \ directory, for example.
    After my pc has to do the “download” of the image and I see the image on my pc.

    I need suggestions from the community. I have visual studio 2015 installed that I use for C # classes. I have already installed the necessary libraries.

    Do you have the complete program?

    Thank you for your help.

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s