How to transfer data between two devices using WIFI-Direct? - android

I want to write a chat application which uses WIFI-Direct only and there are no internet or routers at all.
I've created a Wi-Fi P2P Application which can see other devices with enabled WIFI-Direct. The android guides are here : Wi-Fi Peer-to-Peer
Two devices connects to each other with WIFI-Direct and the specifications of connected device will be shown in my app.
At this point, I don't know what is the best way to transfer data between this two devices? Socket programming or what else ways are there to do this?
For Socket programming paradigm, the data flow will be from client to server only, how to transfer data in both directions?

Related

Android P2P direct connection for multiple devices. Peer as GroupOwner and client at the same time

I want to create a chat application (without internet connection) for Android-based on P2P communication via WI-FI (or Bluetooth) between 3 or more devices. I would like every device to have a direct connection to all devices. I know that android API provides the WifiP2pGroup class, but in this case, one device is a groupOwner and the other are clients and the other ones do not have a direct connection with each other.
Is it possible for each device to be a groupOwner and client for other devices at the same time (like on the image)? Is there another way to solve my problem?

Sending and receiving data between devices in android over wifi connection

I want to transmit some data (text) between android devices.
Like zapya or shareIt applications.
I don't want to connect each device to a same modem.
I want just to connect two devices over wifi and send/receive data between them.
How can i implement this in android ?
Thanks in advance :)
You'll find what you're looking for here Wifi P2P Android
You can create a peer to peer network between two devices that support it and send arbritrary data between both

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

Communication among two android devices connected over same/different WiFi networks/Mobile Data

I need to develop an application through which TWO or MORE android devices can communicate with each other over same/different WiFi networks or using their mobile data. In short, no matter how they connect to internet, they should be able to communicate just like in whatsapp.
Could someone please guide me how this can be done?

Transfer data between two Android using Wifi

I'm trying to develop an Android application which have to be able to transfer data/message between two Android mobiles, as a client server connection using their own Wifi, which having no network or routers nearby. I just tried using Tcp program to do this but it fails, its not connecting, I'm getting ConnectException and connection refused.
[Edited] Is it possible to achieve this using Android Portable Hotspot integrated with application? Is there any tutorial regarding this approach?
Any Ideas, how to do this?
Thanks.
You need to get the two devices networked to each other before you can worry about tcp usage of that network connection.
If one device is willing to perform access-point like functionality as part of a portable hotspot, and you select that as a wirelss network on the other, you may achieve a network connection between the two that can be used for custom traffic. Though there are ways the hotspot could be implemented where that would not work. Also of concern, the "client" device will now be sending all of its network traffic through the hotspot device, including not just foreground apps but anything it decides to do in the background.

Categories

Resources