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?