.NET Zone is brought to you in partnership with:

I’ve been a Windows developer since 3.0 and caught the Visual Basic wave early with v1. I’ve released a “production” application in every version of VB since then (except VB for DOS). Focusing on enterprise, line-of-business development I’ve built Call Center Applications, Mortgage finance systems, Customer Relationship Management tools and more recently I’ve been in the Litigation Support/Electronic Data Discovery/Electronically Stored Information space. Greg is a DZone MVB and is not an employee of DZone and has posted 477 posts at DZone. You can read more from them at their website. View Full User Profile

Getting Your App's "Close", Using Windows 8.1/WinRT and Wifi-Direct and Proximity API's

  • submit to reddit

Stéphanie Hertrich - WinRT : Transferring 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 functionality 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 functionality and its sample demo application so that you can test it.

Please be aware that this was not tested for production : if you use it as is, it is at your own risks.

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

How does the lib work ?

The WifiDirectTransfer library is based on the Proximity API. It is VERY easy to use : you just need 3 lines of code.

The lib contains a WifiDirectFileTransfer class.



While I'm very likely going to highlight this in a future Coding4Fun Blog post, I wanted to call it out here as this post really looks like it makes Wifi-Direct enabling your applications easy. So now you can build your next awesome app and while in the car, plane, train this holiday you can share your data, no net required! Imaging building your kids a card game where they can share or trade cards. No wait! A license plate game where they are take pictures of plates and then trade them... hum... Thinking about that, a recent post I did on the C4F blog might come in handy too, Windows 8.1, Windows Phone, NFC, Bluetooth and help in building connected app's.

Published at DZone with permission of Greg Duncan, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)