# Wi-Fi Direct

## Summary


Wi-Fi-Direct is a standard developed by Wi-Fi Alliance so that Wi-Fi devices can connect and communicate with each other directly without using an access point (AP). This is also known as Wi-Fi P2P (Wi-Fi Point-to-Point). This is very useful for direct file transfer, internet sharing, or connecting to a printer. Wi-Fi Direct can communicate with one or more devices simultaneously at typical Wi-Fi speeds.

Wi-Fi Direct supports IEEE 802.11 a/b/g/n/ standards.

## Discussion

### Can you explain how Wi-Fi Direct works?

Wi-Fi Direct works in two steps: 

    + **Device Discovery**: A device first broadcasts a probe request message asking for MAC ID from all nearby devices. This stage is similar to the scanning phase in regular Wi-Fi. All devices that hear this message respond with a unicast message to the sender. Devices alternate between sending out and listening for probe requests, and subsequently their responses.
    + **Service Discovery**: Now the sender sends a unicast service request message to each device. The receiving devices responds with unicast message with service details.In terms of the states or phases of Wi-Fi Direct, devices go through scan phase (scan the channels), find phase (which includes service discovery), formation phase (group is formed and includes WPS provisioning), and operational phase. Whereas discovery happens on Social channels 1, 6 and 11 in the 2.4GHz band, operation can be in either 2.4 or 5GHz bands. 


### How many devices can Wi-Fi Direct connect?

A Wi-Fi Direct-certified network can be one-to-one, or one-to-many. The number of devices in a Wi-Fi Direct-certified group network is expected to be smaller than the number supported by traditional standalone access points intended for consumer use. Connection to multiple other devices is an optional feature that will not be supported in all Wi-Fi Direct-certified devices; some devices will only make 1:1 connections. 


### Can you explain architecture of Wi-Fi Direct?

As Wi-Fi Direct does not require any AP, the device itself has the capability to function like AP. Wi-Fi Direct devices, aka P2P Devices, communicate by establishing P2P Groups, which are functionally equivalent to traditional Wi-Fi infrastructure networks. The device implementing AP-like functionality in the P2P Group is referred to as the *P2P Group Owner (P2P GO)*, and devices acting as clients are known as *P2P Clients*. P2P GO is sometimes referred to as *Soft AP*. 

Wi-Direct devices can function as 1:1 and 1:n devices. The shown topology in the diagram explains the scenario of 1:1 and 1:n. In 1:1 scenario, a Wi-Fi Direct device is printing files at a printer. In 1:n scenario, a laptop is sharing files to three other Wi-Fi devices. 


### Is it possible for Group Owner to connect to Wi-Fi AP?

Only the P2P GO is allowed to cross-connect the devices in its P2P group to an external network. Wi-Fi Direct does not allow transferring the role of P2P GO within the group. If P2P GO leaves the P2P group, then the group is torn down, and has to re-established. 


### Can you explain how group formation happens?

Group formation procedure involves two phases: 

    + **Determination of P2P Group Owner**: Two P2P devices negotiate for the role P2P Group Owner based on desire/capabilities. P2P GO role is established at formation or at an application level.
    + **Provisioning of P2P Group**: P2P group session is established using appropriate credentials. Wi-Fi simple configuration is used to exchange credentials.There are three ways of group formation: Standard, Autonomous and Persistent. In **Standard**, P2P devices discover each other and negotiate who will act as P2P GO. In **Persistent**, devices recall if they've had a previous connection with persistent flag set. If so, GO Negotiation Phase (3-way handshake) is replaced with Invitation Phase (2-way handshake). WPS Provisioning is simplified since stored network credentials are reused. 


### Can you explain how service discovery happens?

Service Discovery process enables Wi-Fi Direct devices to discover each other and the services they support before connecting. For example, a Wi-Fi Direct device could see all compatible devices in the area and then narrow down the list to only devices that allow printing before displaying a list of nearby Wi-Fi Direct-enabled printers. Before establishment of a P2P Group, P2P Devices can exchange queries to discover the set of available services and, based on this, decide whether to continue the group formation or not.

*Generic Advertisement Service (GAS)* as specified by 802.11u is used. GAS is a layer 2 query and response protocol implemented through the use of public action frames, that allows two non-associated 802.11 devices to exchange queries belonging to a higher layer protocol (e.g. a service discovery protocol).


### How is security implemented in Wi-Fi Direct?

Wi-Fi Direct devices are required to implement Wi-Fi Protected Setup (WPS) to support a secure connection with minimal user intervention. WPS is based on WPA-2 security and uses AES-CCMP as ciphering, and a randomly generated Pre-Shared Key (PSK) for mutual authentication. 


### Could you explain Wi-Fi Direct's Power Saving Mode?

Wi-Fi Direct defines two new power saving mechanisms: 

    + **Opportunistic Power Save Protocol**: The Opportunistic Power Save protocol (OPS) allows a P2P Group Owner to opportunistically save power when all its associated clients are sleeping. This protocol has a low implementation complexity but, given the fact that the P2P Group Owner can only save power when all its clients are sleeping, the power savings that can be achieved by the P2P Group Owner are limited.
    + **Notice of Absence Protocol**: The Notice of Absence (NoA) protocol allows a P2P GO to announce time intervals, referred to as *absence periods*, where P2P Clients are not allowed to access the channel, regardless of whether they are in power save or inactive mode. In this way, a P2P GO can autonomously decide to power down its radio to save energy.

### What's the speed of Wi-Fi Direct?

A Wi-Fi Direct-certified device supports typical Wi-Fi speeds, which can be as high as 250 Mbps. Even at lower speeds, Wi-Fi provides plenty of throughput for transferring multimedia content with ease. The performance of a particular group of Wi-Fi Direct devices depends on whether the devices are 802.11 a, b, g, or n, as well as the particular characteristics of the devices and the physical environment. 


### Can you relate Wi-Fi Direct to Miracast?

Miracast is a Wi-Fi display certification program announced by Wi-Fi Alliance for seamlessly transferring video between devices. The intersection of wireless connectivity and streamed audio/video content can be termed as *Miracast*. This solution enables seamless mirroring of entire displays across devices or sharing of any type of content that a source could display using Wi-Fi Direct. 


### Why is the design of Wi-Fi Direct based on infrastructure mode and not ad hoc mode?

Most commercial devices are for infrastructure mode and not ad hoc mode. For easier migration and interworking with legacy devices, Wi-Fi Direct is based on infrastructure mode. Wi-Fi Direct works on the principles similar to that of Wi-Fi AP. Hence, the P2P GO is sometimes also called *Soft AP*. .


### Is it sufficient for only one device to be Wi-Fi Direct-certified to form a group?

Yes. Only the P2P GO needs to be Wi-Fi Direct-certified. Other group members may be legacy Wi-Fi stations that operate in infrastructure mode. Wi-Fi Direct essentially embeds a software access point for the group owner. The soft AP provides a version of Wi-Fi Protected Setup with its push-button or PIN-based setup. Thus, group members see only an AP. 


### What are the pros and cons of Wi-Fi Direct?

Wi-Fi Direct can connect multiple devices without a Wi-Fi AP. Wi-Fi Direct is portable. No Internet connection is required to transfer files between two devices. Only one device needs to be Wi-Fi Direct-certified and it can assume the role of the group owner. 

Wi-Fi Direct has some limitations. Not all vendors support it. Connection has to be re-established with other devices every time to form the group. As soon as GO leaves the group, all connections are broken and service stops. The group is formed as a star topology with the GO at the center. Group members cannot talk to each other directly. 

Protected by WPA2, Wi-Fi Direct is secure, but applications could use it wrongly and thereby compromise overall security. Devices connect using Wi-Fi Protected Setup (WPS) but implementations that use WPS PIN method of setup are insecure. An analysis from April 2020 of some popular Android applications that use Wi-Fi Direct found 17 security issues. These applications (SHAREit, Xender, Xiaomi Mi Drop, Files by Google, Zapya and SuperBeam) often compromised security in favour of usability. 

## Milestones

Oct  
2010

Wi-Fi Alliance launches Wi-Fi Direct certification program. Within the same month, Atheros, Broadcom, Intel, Ralink and Realtek announce their first certified products. A month later, *Popular Science* magazine recognizes Wi-Fi Direct as one of the best tech innovations of the year. 

Oct  
2011

Google announces Wi-Fi Direct support in Android 4.0. 

Mar  
2016

Sony, LG, Philips and X.VISION implement Wi-Fi Direct on some of their televisions. 

Jun  
2017

With the growing adoption of Software Defined Networking (SDN), Poularakis et al. explore how SDN can be applied to wireless mobile networks. Traditional SDNs are centralized in the network whereas mobile networks require a distributed architecture. They propose a hybrid architecture. In one example, they should how Wi-Fi Direct can also be part of the network. A Wi-Fi Direct smartphone also becomes a virtual switch due to *Open vSwitch* and uses *OpenFlow* protocol.