예외가 발생하는 동안 Android 애플리케이션에서 HTTP Listener를 실행하려고합니다.
SocketException : 이미 사용중인 주소
Unity Player는 Windows 용 빌드와 마찬가지로 오류를 생성하지 않습니다. 장치의 netstat가 표시됩니다. 항구가 누구도 점유하지 않는다는 사실이 문제가 될 수 있습니까? 매니페스트에 무언가를 추가해야할까요?
내 코드 (포트 37273)
private void Listen()
{
Debug.Log("START HTTP LISTENIER!");
listener = new HttpListener();
listener.Prefixes.Add("http://localhost:" + port.ToString() + "/");
listener.Prefixes.Add("http://127.0.0.1:" + port.ToString() + "/");
listener.Prefixes.Add("http://*:" + port.ToString() + "/");
listener.Start();
while (connect)
{
try
{
Process(listener.GetContext());
}
catch (Exception ex)
{
Debug.Log("HTTP listener context Exeption: " + ex.ToString() + "\n " + ex.Message);
}
}
}
StackTrace
05-08 07 : 42 : 15.751 4606 4699 E Unity : SocketException : 이미 사용중인 주소 05-08 07 : 42 : 15.751 4606 4699 E Unity : System.Net.Sockets.Socket.Bind (System.Net.EndPoint localEP) [0x00043] in <0813754e7cfa415ebfedff172c2dd6e0> : 0 05-08 07 : 42 : 15.751 4606 4699 E Unity : at System.Net.EndPointListener..ctor (System.Net.HttpListener listener, System.Net.IPAddress addr, System.Int32 port , System.Boolean secure) [0x00047] in <0813754e7cfa415ebfedff172c2dd6e0> : 0 05-08 07 : 42 : 15.751 4606 4699 E Unity : at System.Net.EndPointManager.GetEPListener (System.String 호스트, System.Int32 포트, System.Net .HttpListener listener, System.Boolean secure) [0x0009d] in <0813754e7cfa415ebfedff172c2dd6e0> : 0 05-08 07 : 42 : 15.751 4606 4699 E Unity : at System.Net.EndPointManager.AddPrefixInternal (System.String p, System.Net.HttpListener listener) [0x0005e] in <0813754e7cfa415ebfedff172c2dd6e0> : 0 05-08 07 : 42 : 15.751 4606 4699 E Unity : at System.Net.EndPointManager.AddListener (System.Net.HttpListener listener) [0x0009c] in <0813754e7cfa415ebfedff172c2dd6e0> : 0> : 0 05-08 07 : 42 : 15.751 4606 4699 E Unity : at System.Net.HttpListener.Start () [0x0000f] in <0813754e7cfa415ebfedff172c2dd6e0> : 0 05-08 07 : 42 : 15.751 4606 4699 E Unity : at WebServer.Listen ( ) [0x00093] in : 0 05-08 07 : 42 : 15.751 4606 4699 E Unity : at System.Threading.ThreadHe0813754e7cfa415ebfedff172c2dd6e0> : 0 05-08 07 : 42 : 15.751 4606 4699 E Unity : at WebServer.Listen () [0x00093] in : 0 05-08 07 : 42 : 15.751 4606 4699 E Unity : at System.Threading.ThreadHe0813754e7cfa415ebfedff172c2dd6e0> : 0 05-08 07 : 42 : 15.751 4606 4699 E Unity : at WebServer.Listen () [0x00093] in : 0 05-08 07 : 42 : 15.751 4606 4699 E Unity : at System.Threading.ThreadHe
어떤 이유로 Unity가 내 보안 구성을 무시하고 자체 보안 구성을 삽입하여 cleartextTrafficPermitted를 false로 변경하여 문제가 해결되었습니다.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다