1
我試圖轉換一個代碼,可以處理Mono中的TCP服務器。它是從this chat app for Windows tutorial的代碼。不過,我得到的錯誤:適用於Android的TCP Server Mono Socket.bind
ListenForClient Access Denied!
它是由這部分代碼創建:
try
{
//We are using TCP sockets
serverSocket = new Socket(AddressFamily.InterNetwork,
SocketType.Stream,
ProtocolType.Tcp);
//Assign the any IP of the machine and listen on port number 1000
IPEndPoint ipEndPoint = new IPEndPoint(IPAddress.Any, 1000);
//Bind and listen on the given address
serverSocket.Bind(ipEndPoint);
serverSocket.Listen(4);
//Accept the incoming clients
serverSocket.BeginAccept(new AsyncCallback(OnAccept), null);
}
catch (Exception ex)
{
System.Console.WriteLine("@ ListenForClient" + ex.Message);
Android.Util.Log.Info("ListenForClient", ex.Message);
}
它看起來像該serverSocket.Bind(IPEndPoint);
沒有在單聲道允許Android系統。 有人知道解決方法或知道爲什麼不允許?
嗨Reint Jan Hoiting,我無法讓我的套接字服務器在模擬器上工作。我試過你的解決方案,但沒有成功。任何指針? –