Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Connect 2 or more Android clients directly

I want to connect 2 or more Android devices with p2p connection. As I understand I may use Wi-Fi Direct under one wifi network https://developer.android.com/guide/topics/connectivity/wifip2p.html

But I want to connect Android clients located in different places but possibly with the one IP (vpn or something). How can I do that?

Here is my algorithm

Client_1 register its name and current IP on Server
Client_2 register its name and current IP on Server
Client_1 request registred IP from Server by Client_2 name
Client_2 request registred IP from Server by Client_1 name
Client_1 send message directly to Client_2 IP

This algorithm will not work if Client_1 and Client_2 has the same IP. Or if client is behind NAT.

Is there a ready to use library to connect 2 or more Android devices in such way?

like image 783
user1312837 Avatar asked Aug 06 '16 12:08

user1312837


People also ask

How many devices can Wi-Fi Direct connect to?

Unsourced material may be challenged and removed. Wi-Fi Direct (formerly Wi-Fi Peer-to-Peer) is a Wi-Fi standard for peer-to-peer wireless connections that allows two devices to establish a direct Wi-Fi connection without an intermediary wireless access point, router, or Internet connection.

What is P2P device?

In peer-to-peer (P2P) networking, a group of computers are linked together with equal permissions and responsibilities for processing data. Unlike traditional client-server networking, no devices in a P2P network are designated solely to serve or to receive data.

What is a Wi-Fi Direct?

Wi-Fi Direct (also known as peer-to-peer or P2P) allows your application to quickly find and interact with nearby devices, at a range beyond the capabilities of Bluetooth. The Wi-Fi peer-to-peer (P2P) APIs allow applications to connect to nearby devices without needing to connect to a network or hotspot.


1 Answers

You can use Fixed Ip Simcards if you want to do a setup for your personal purpose. Another option is to convert your android phone local private ip into public ip , this can be done via Update No-IP app , this app will give you a direct link to communicate with public ip you have.

I hope my answer would be somewhat helpful to you.

like image 90
Deepak Kumar Mahto Avatar answered Oct 05 '22 18:10

Deepak Kumar Mahto