Using Wifi-Direct and Proximity API for peer file transfers

Sign in to queue


In our first Hardware Friday post of the year, we're going to highlight a project from Stéphanie Hertrich that might help you write code that leverages hardware you might already have...

WinRT : Transfering a file between 2 peers using Wifi-Direct and Proximity API

On Windows 8.1 and WinRT, Wifi-direct enables wireless direct communication scenarios between devices executing the same application. That means you can exchange data between peers in areas without any internet network connectivity. All you need is a device that supports Wifi-Direct technology (Surface RT does, as well as most Windows 8 devices). This is complementary to the Share charm functionnality which helps sharing data between 2 apps on the same machine. Here you will share stuff on different machines that are executing the same app.

Wifi-direct can be a good alternative to NFC for some scenarios : you don’t need any NFC hardware but still can communicate between several close peers without network connectivity. If ever you want to test NFC but you don’t have the appropriate hardware, I wrote an article explaining how to install an NFC simulator driver on Windows 8.1 : Windows 8.1 : How to use Near-Field Proximity API without NFC hardware.

Wifi-direct communication is made possible thanks to the Proximity API (just like NFC does, but with different scenarios).

Here is a small lib providing the Wifi-direct file transfer fonctionnality and its sample demo application so that you can test it.


In this article, you will find:

  • how to use the lib and the sample app
  • behind the scene : how the Proximity API handles Wifi-direct
  • more possibilities for Wifi-direct scenarios




- Start browsing for other peers (Start)

- Send a file to a peer (ConnectAndSendFileAsync)


- Register to the ConnectionRequested event

- Start listening to other peers (Start)

- Receive and save a file once a peer connected to you (ReceiveFileAsync)






More possibilities with the Proximity API

Other scenarios are available, like listening to any proximity event occuring (with PeerFinder.CreateWatcher) or providing an early access to peer’s data during the accept phase. It can be useful to help decide how to handle the peer that is trying to connect or if it should accept the connection or not.

She makes it look pretty easy, doesn't she? Hopefully you're now thinking about how cool you can make the sharing in your app's...

The Discussion

  • User profile image

    @nana kobina: That would be great. If you post your project on a site like Codeplex, Github, CodeProject let us know (via the Contact Us). In the mean time, I've removed your comment (since it had your complete and un-obfuscated email address) to avoid you getting any spam, etc.

  • User profile image
    nana kobina

    alright sir ,i will do exactly that.
    thanks so much.realy appreciate.

  • User profile image
    Doug Frisk

    The sample looks good, but like every other Wifi Direct/proximity sample I've tried it fails with "The wireless local area network interface is powered down and doesn't support the requested operation. (Exception from HRESULT: 0x80342002)" when the call to PeerFinder.FindAllPeersAsync is made on my Surface RT.

    It sounds like this is an issue with the Surface RT/Pro as documented here:

    Is there something that needs to be configured on the surface to make this work?

Add Your 2 Cents