Answer the question
In order to leave comments, you need to log in
Xamarin Forms. Android. How to properly organize access to the socket server?
Good afternoon. I am developing in Xamarin Forms for Android. I'm trying to raise a socket server on a smartphone. The client is a console application.
I get the address of the server (smartphone) as follows:
IPAddress[] adresses = Dns.GetHostAddresses(Dns.GetHostName());
if (adresses != null && adresses[0] != null)
{
adr = adresses[0].ToString();
}
strendpoint = adr + ":2780";
IPEndPoint localEndPoint = CreateIPEndPoint(strendpoint);
_server = new TcpListenerServer(localEndPoint);
const int port = 2780;
const string address = "85.26.233.137";
client = new TcpClient(address, port);
NetworkStream stream = client.GetStream();
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question