Answer the question
In order to leave comments, you need to log in
How to communicate between two devices knowing the IP address?
I want to transfer location data from one phone to another (let's say both are Android), I have a server to which I can send IP addresses and other information about the device. Question - how to transfer data between devices without using the server as an intermediate link?
Answer the question
In order to leave comments, you need to log in
1. Open a receive socket (LISTEN) on one of the TCP or UDP devices and report the port number on which it is waiting for a connection to the server in the same packet with an IP address.
2. Any other device - connect using IP:port received from the server.
If you are not afraid of conflicts, then the server port can be hard-coded for your application (flashed in the code) and then step 1 will be redundant. But it's more correct with him.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question