I have this console app websocket server:
Console.WriteLine("[SERVER]");
TcpListener server = new TcpListener(IPAddress.Parse("127.0.0.1"), 80);
server.Start();
Console.WriteLine("Server has started on {0}.{1}Waiting for a connection...", server.LocalEndpoint, Environment.NewLine);
TcpClient client = server.AcceptTcpClient(); //wait for client to connect
Console.WriteLine("A client connected.");
NetworkStream stream = client.GetStream(); //communication channel with client
How can I connect to the console app server in an Xamarin.Android app?
I have tried this (inside xamarin android app, click event for button): But I get an exception from 'client.Connect("127.0.0.1", 80);'
Exception = System.Net.Sockets.SocketException: Connection refused
requestSpeak.Click += (o, e) =>
{
TcpClient client = new TcpClient();
client.Connect("127.0.0.1", 80); //connect to sv
NetworkStream stream = client.GetStream(); //communication channel with server
};