MirrorNetworking / Telepathy

Simple, message based, MMO Scale TCP networking in C#. And no magic.
MIT License
1.17k stars 136 forks source link

Issue with connecting to server #118

Closed benjaben closed 2 years ago

benjaben commented 2 years ago

I'm having an issue with my android device trying to connect to a server. It immediately get's disconnected with the following error:

Client Recv: failed to connect to ip=XX.XX.XXX.XXX port=30000 reason=System.Net.Sockets.SocketException (0x80004005): Connection refused System.Net.Sockets.Socket.Connect (System.Net.EndPoint remoteEP) [0x00000] in <00000000000000000000000000000000>:0 System.Net.Sockets.TcpClient.Connect (System.String hostname, System.Int32 port) [0x00000] in <00000000000000000000000000000000>:0 Telepathy.Client.ReceiveThreadFunction (System.String ip, System.Int32 port) [0x00000] in <00000000000000000000000000000000>:0 System.Threading.ThreadStart.Invoke () [0x00000] in <00000000000000000000000000000000>:0 System.Threading.ContextCallback.Invoke (System.Object state) [0x00000] in <00000000000000000000000000000000>:0 System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <00000000000000000000000000000000>:0 System.Threading.ThreadSta

The odd thing is that other clients are able to connect (The Unity Editor Client in particular). The server runs in a docker container and has remapped ports. I'm not sure if that makes a difference though.

benjaben commented 2 years ago

I believe the issue was I wasn't setting the server to listen in time before the connections arrived.