A
A
Auratos2019-08-23 21:30:32
client-server
Auratos, 2019-08-23 21:30:32

Xamarin Forms. How to connect from the outside by IP to the server during debugging?

Good afternoon. Comrades, I have a problem - I can not connect from the outside to the server during debugging, running inside the emulator on Xamarin Forms. It was during debugging! Those. I have a client - a separate device with a SIM card, which connects to the server via a mobile network via IP and port. So, when I compile the project and run the application (server) on the phone, the client calmly connects to me. But inside the emulator during debugging does not want to.
Corporate network. The corporate server IP address is 94.198.1.105 . The client (device) knocks on this address on port 2781 . And the server is already redirecting data to the IP of my working machine - 192.168.1.90 and port 2780 .
I will briefly describe the methods that I have already tried.
1) I have a simple self-written client - a console application that also knocks on IP and port. I start the server in debugging with parameters 127.0.0.1:2780 , I start the client on the same machine, it knocks on 127.0.0.1:2780 . I forward data from port 2780 of the real machine to port 2780 of the emulator with the following command. I
adb – s forward tcp:2780 tcp:2780
start the server and the client - the client connects to the server in debug.
2) I compile the project. I start the server on the phone, find out the IP of the phone using C# - IP 192.168.1.90 . I create an access point 192.168.1.90:2780 . The client (device) is knocking on 94.198.1.105:2781and connects to my mobile server.
3) the client (device) knocks on 94.198.1.105:2781 . I start the server in debugging in the emulator, I get its IP using C# - IP 192.168.232.2 . I create an access point - 192.168.232.2:2780 . The server is running. I forward port
adb – s forward tcp:2780 tcp:2780
The client does not see the server. At the same time, in the emulator itself, I check the external IP through the browser on 2ip.ru - it shows that the IP is 94.198.1.105 , i.e. IP of our corporate server.
4) I repeat all the steps from point 3). But I'm still trying to forward data from 192.168.1.90:2780 (the local IP of my work machine) to 192.168.232.2:2780(local IP of the emulator) in the following way via the command line:

netsh interface portproxy
add v4tov4 listenport=2780 listenaddress=192.168.1.90 connectport=2780 connectaddress=192.168.232.2
show all

The client (device) connects somewhere from time to time, but it's not a debugger. I reset the netsh settings (I type “reset” on the command line) and the client can no longer connect.
Please tell me if there are any other ways?
Here is an approximate diagram of how access is organized
5d6030c1729b7484735060.jpeg

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question