P
P
Popou2021-11-01 07:44:20
C++ / C#
Popou, 2021-11-01 07:44:20

How to transfer data through an access point?

The computer is connected to the phone via an access point, let's say I use sockets, but then the question is, what is their common ip?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
rPman, 2021-11-01
@Popou

The simplest thing is to agree on two machines (pc and smartphone) about what ip addresses they have through the third server machine, both machines send a message about themselves to the server, and the server, in turn, looks at the ip address from which it came and if it is the same - so these two messages came from machines located nearby.
In rare cases, this will not work if, for example, there is an 'Internet accelerator' based on load balancing between two or more providers, as well as if the ip address changes at the time the message is sent (yes, you should be very unlucky, but it is possible)
Correct - implement broadcasting within the local network, the server is not needed, but on android this is problematic.
But there is a network service discover(works on the basis of the DNS-SD mechanism) the first code example from Google

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question