Is multicasting possible with Wi-Fi Direct? - android

I'm a bit confused about the new Wi-Fi Direct feature in Android ICS. Is it possible to create a P2P group with multiple devices, and send multicast packets from a source peer to the other peers?
Unfortunately, I don't have any devices that are Wi-Fi Direct enabled, so I can only browse the examples that I find online. In these examples, I could only find peers establishing 1-on-1 connections. So, is multicasting possible?

Is it possible to create a p2p group with multiple devices ?
Based on the Industry white paper and the technical specs, yes it is possible to create a group with multiple devices, you will have a one-to-many connection, one Group Owner (GO) and many clients.
Send multicast packets from a source peer to the other peers?
Based on the technical specs, the GO shall act as a DHCP server and provide an IP address to the connected clients (which should act as a DHCP client). Each device can easily know its own IP and the GO's IP, so it should be possible to do a broadcast using the address 255.255.255.255.
Regarding a proper multicast, I am not sure, I guess it depends on the capabilities of the DHCP server created.

Related

Android udp server cannot receive data via SIM card(4G)

I created a UDP server on android app, and this UDP server is reachable via wifi (Local network). I can receive and send data. However when I change to 4G network. The UDP server on Android not able to receive anything. I use ip chicken to check my cell phone IP address and my UDP server port is 2004. Is there anything wrong? or my public ip is not correct?
Assuming that your phone IP address is correct, and it looks like you have checks this, it is important to know that mobile network providers may not support UDP inbound connections on their networks.
While it's not true to say that all don't, it is true to say that not all do so if you want your solution to be portable across networks you may need to look at alternatives anyway.
There are examples and guides on traversing network address translation boundaries on networks - one good example, which is looking at peer to peer applications, is here: http://bford.info/pub/net/p2pnat/

Which API/method does Xender use to bypass Wifi Security

I am amaze to see how Xender bypass all WIFI related security checks and can connect to any other device easily that have Xender running and then transfer files. In Android, conventionally we create a hotspot and other joins that hotspot but Xender seems to have its own way to connect to other devices(basically same as the conventional method). Is it WIFI direct or something else? I also want to do the same. Can anyone please give some light on this. Thanks in Advance!
It is a peer-to-peer connectivity. One mobile acts as a server and other as a client. And, to create the connection we have to connect the "sockets" of the two mobiles which are created dynamically.
As soon as these sockets get connected, we can send data in form of byte stream, which in the case of Wifi-Direct, is extremely fast.
The Wi-Fi peer-to-peer (P2P) APIs allow applications to connect to
nearby devices without needing to connect to a network or hotspot .
Wi-Fi P2P allows your application to quickly find and interact with
nearby devices, at a range beyond the capabilities of Bluetooth.
In case of Android's implementation of Wifi-Direct, having multiple servers is not possible. See the Android's reference. It says:
A p2p group consists of a single group owner and one or more clients.
In the case of a group with only two devices, one will be the group
owner and the other will be a group client
reference guide for connectivity can be found here

Network discovery with ARP

i don't know if it's the right community to ask (i think so, by the way) so excuse me in advance if this is off topic.
I was thinking about a project in android that involves knowing how many devices are in the surroundings.
Is there a way to "discover" it? My idea is something like this:
my device sends some sort of broadcast ping via ARP (or some Data Link protocol)
Every device answers to that ping
My device counts how many response pings are and this is how many surrounding devices are.
I'm saying ARP or some Data Link Protocol because it should be "beyond wifi connection", knowing not "how many devices are connected to my network" but "how many devices surround me"
Thank you in advance!
IPv4 ARP requests are broadcasts, but they contain the specific IPv4 address of the host for which you are requesting the layer-2 address. All hosts on the layer-2 domain will receive the ARP request, but only the host with the specific IP address will respond to the ARP request.
There are many ways in which LAN discovery tools work, but none of the methods are foolproof because the network protocols were not built with LAN discovery in mind. Also, there are ways in which to configure some LAN devices so that it is difficult to impossible for the hosts to be discovered, e.g. private VLANs, where hosts on the private VLAN cannot communicate with any other host on the same VLAN, except for the gateway.

Change WiFi-Direct IP range? Force IPv6 in Android WiFi-Direct?

I have two Android KitKat phones, both are running WiFi-Direct groups as Group Owners, let's call them GO1 and GO2
I managed to connect GO1 as a legacy client to GO2 without breaking any of the (previously set) wifi-direct groups.
The problem is that, as you might know, the GO IP address is hardcoded in Android source, and is set to 192.168.49.1
Therefore, both of my devices, GO1 and GO2 have the same IP address (**)... each on his local network.
My app is both client and server at the same time. But both networks are using the same IP range (192.168.49.XXX), which, apparently, I cannot change.
As a result I cannot create a TCP connection between them if they are both hosting a WiFi-Direct Group, since any device will connect to itself when trying to connect to 192.168.49.1
So the questions are:
Is there a way to change the IP range used in Wifi-Direct?
Is there a way to use IPv6 instead of IPv4 in Wifi-Direct?
Can any of this be done without rooting the phone?
Any other suggestion?
** : Actually, because GO1 is connecting as a legacy client to GO2, then GO1 is known as 192.168.49.227 (for example) to GO2 and GO2 is known as 192.168.49.1 to GO1. But because GO1 is ALSO a GO, it also known as 192.168.49.1 to his clients (and itself).
A way to get around this without rooting the phone is to send your packets via multicast UDP*. These packets will make it from GO1 to GO2.
There are some side effects to this:
To use this for networking you must perform encapsulation and routing at the OSI Application level (not efficient).
You will also need to route based on MAC addresses since every device has the same 192.168.49.1 address.
"It is important to note that the multicast socket encapsulates a one-to-many unicast communication and, as a result of this, cannot fully utilize the total available WiFi and WiFi Direct bandwidth" *
Something else worth noting:
As you scale up the number of GOs, you will run into a problem of all nodes operating on the same wifi channel. This isn't a problem with a few devices, but with hundreds of devices, it will be a huge problem.
*This method was mentioned in Colin Funai, Cristiano Tapparello, and Wendi Heinzelman paper titled "Supporting Multi-hop Device-to-Device Networks Through WiFi Direct Multi-group Networking" found here: https://arxiv.org/pdf/1601.00028.pdf
There is no way to change the IP range because as you have correctly pointed out, it is hardcoded in the Android Wi-Fi Direct system service. Personally, I am not aware of IPv6 being enabled on the Wi-Fi P2P interface, and even if it was, it would likely be a hardcoded IPv6 address.
If GO1 and GO2, must be connected to each other whilst both in GO mode, then perhaps look at using Bluetooth or some other transport to allow them to communicate. If communication between GO1 and GO2 can be delayed, then cache whatever information is to be exchanged, and send it between these two devices when one can be the client of the other, e.g. when GO1 can stop being a GO and can be a client of GO2.

Does Wifi access points have an ip address?

I am trying to make an application which can connect from a mobile to a wifi controller. Planning to do a socket connection(multicast) ... The only values that i am able to get through the wifi android apis are SSID and BSSID.. Can anyone tell me if i am supposed to proceed with these values or am i supposed to connect with an IP address ? If i am supposed to connect with BSSID.. how do i go about it?
Wifi access points need not have an IP address, any more than wired switches and hubs do. However a large number do, as they also act on the IP layer as DHCP servers and network gateways.
What exactly are you trying to do? It sounds likely that it is not the Wifi access point proper that you need to talk to.
If it supports TCP and UDP, it will of course have an IP address. This will not be directly discoverable from the Wifi APIs, and you'll need some other means of discovering that. It's hard to say what exactly will be a reasonable method to do this without knowing what the AP is, and what services it provides.
Common ways of enumerating services provided on a network include DHCP; multicast DNS/DNS service discovery which is used by "Bonjour" and "Zeroconf"), SSDP and uPnP, and of course static configuration.
I'm not familiar enough with the Android network APIs to recommend anything, though http://jmdns.sourceforge.net/ appears to be a usable Java multicast DNS library.

Categories

Resources