There is a task: to connect two phones on the Internet. Phones can be connected both via Wi-Fi and mobile Internet (even between different countries). The design, if possible, should be autonomous.

One phone should act as a server, and the second - as a client. The client must request information (you can say a stream of bytes) and send.


What can this be done with?

Closed due to the fact that the question is too general fori1ton , Vadim Ovchinnikov , AK , user194374, pavel participants on Jan 6 '17 at 11:31 .

Please correct the question so that it describes the specific problem with sufficient detail to determine the appropriate answer. Do not ask a few questions at once. See “How to ask a good question?” For clarification. If the question can be reformulated according to the rules set out in the certificate , edit it .

  • Maybe with the help of Telegram - Vladimir Gamalyan

1 answer 1

"Link on the Internet" poorly describes the conditions. Can we be sure that they are both connected to WiFi? Will it be the same wifi or not? Can we use a server for this, or should the design be completely autonomous? This greatly influences the choice of solution.

There are several problems to be solved:

  1. Provide connectivity. Not always two devices connected to the Internet can interact directly. The solution is either limiting conditions (connecting to one WiFi), or using an intermediary in the cloud (for example, GCM, Firebase Storage, Firebase RealtimeDatabase, Google Play services, own server, and a bunch of other options).

  2. Detection. It is necessary that the client device finds the server device. In the case of shared WiFi, you can use Dynamic DNS or IP Broadcast distribution. In a more general case, the use of an intermediary in the cloud.

  3. Actually, the transfer of information. The easiest stage. A lot of possibilities: from direct use of sockets to HTTP.

According to the message scattered keywords. Google and choose.

If your task is related to games, then look at the services provided by Google, for example, Real-time Multiplayer

  • Mdja ... I agree, somehow I wrote without any details. In general, the problem is this: two users enter applications, connect to the same room and click the "ready" button. The application gets their names in an online game (PC game), makes sure to create a common room in the game and starts monitoring the game status. After the game is completed, a message is displayed to the winning user. - user189127
  • I have never encountered Google Play Services, will they be able to fulfill the role of a server? Or is there almost no way to do without your server? - user189127
  • Judging by the description, you can pick up something from the available services. Try Paly Services and Realtime Database. - tse