Enviroment
Server started with public IP
if Client A and Client B in same subnet ,download file function work correctly
if Client A and Client B in different subnet ,message can receive,but download file failed!file size stop at 0 bytes!
Here is log
ClientA:
Client.log
Time: 2020/10/15 11:07:58 DEBUG: Connecting directly to Wangxf:81278742EBB8C17114312EA2DAF02AEB9EC198EB...
Time: 2020/10/15 11:07:58 DEBUG: AsyncPeer.ConnectToService(47.96.69.160:10022)
Time: 2020/10/15 11:07:58 DEBUG: AsyncPeer.ServiceConnect()
Time: 2020/10/15 11:07:58 DEBUG: AsyncPeer.WaitConnection(172.24.224.1:58409)
Time: 2020/10/15 11:07:58 DEBUG: ClientWaitPeerConnectionCommand: 172.24.224.1|53324|User:81278742EBB8C17114312EA2DAF02AEB9EC198EB|Wangxf:81278742EBB8C17114312EA2DAF02AEB9EC198EB
Time: 2020/10/15 11:07:59 DEBUG: AsyncPeer.ConnectToPeer(Wangxf:81278742EBB8C17114312EA2DAF02AEB9EC198EB, 172.24.224.1:53324)
Time: 2020/10/15 11:07:59 DEBUG: ClientConnectToPeerCommand: Wangxf:81278742EBB8C17114312EA2DAF02AEB9EC198EB|172.24.224.1:53324
Time: 2020/10/15 11:07:59 DEBUG: AsyncPeer.PeerConnected(User:81278742EBB8C17114312EA2DAF02AEB9EC198EB)
Time: 2020/10/15 11:07:59 DEBUG: AsyncPeer.PeerConnected(Wangxf:81278742EBB8C17114312EA2DAF02AEB9EC198EB)
Time: 2020/10/15 11:11:57 DEBUG: AsyncPeer.ConnectToService(47.96.69.160:10022)
Time: 2020/10/15 11:11:57 DEBUG: AsyncPeer.ServiceConnect()
Time: 2020/10/15 11:11:57 DEBUG: AsyncPeer.WaitConnection(36.23.115.101:20076)
Time: 2020/10/15 11:11:57 DEBUG: ClientWaitPeerConnectionCommand: 202.107.200.171|58081|Wangxf:81278742EBB8C17114312EA2DAF02AEB9EC198EB|DJ:81278742EBB8C17114312EA2DAF02AEB9EC198EB
UnhandledError.log
Time: 2020/10/15 11:06:56;
Type: System.NullReferenceException;
Message: 未将对象引用设置到对象的实例。;
StackTrace:
在 Engine.Network.AsyncPeer.Finder.Equals(NetConnection connection) 位置 D:\Users\WXF\Source\Repos\TCPChat\Engine\Network\AsyncPeer.cs:行号 500
在 System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable1 source, Func
2 predicate)
在 Engine.Network.AsyncPeer.FindConnection(UserId id) 位置 D:\Users\WXF\Source\Repos\TCPChat\Engine\Network\AsyncPeer.cs:行号 485
在 Engine.Network.AsyncPeer.SendMessage(UserId peerId, IPackage package, Byte[] rawData, Boolean unreliable) 位置 D:\Users\WXF\Source\Repos\TCPChat\Engine\Network\AsyncPeer.cs:行号 312
在 Engine.Network.AsyncPeer.OnPeerConnected(NetIncomingMessage message) 位置 D:\Users\WXF\Source\Repos\TCPChat\Engine\Network\AsyncPeer.cs:行号 600
在 Engine.Network.AsyncPeer.OnReceive(Object obj) 位置 D:\Users\WXF\Source\Repos\TCPChat\Engine\Network\AsyncPeer.cs:行号 533
在 Engine.Helpers.EngineSyncContext.Event.Dispatch() 位置 D:\Users\WXF\Source\Repos\TCPChat\Engine\Helpers\EngineSyncContext.cs:行号 38
在 Engine.Helpers.EngineSyncContext.ThreadFunc(Object state) 位置 D:\Users\WXF\Source\Repos\TCPChat\Engine\Helpers\EngineSyncContext.cs:行号 123
在 System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
在 System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
在 System.Threading.ThreadPoolWorkQueue.Dispatch()
ClientB
Client.log
Time: 2020/10/15 11:07:58 DEBUG: Connecting directly to Wangxf:81278742EBB8C17114312EA2DAF02AEB9EC198EB...
Time: 2020/10/15 11:07:58 DEBUG: AsyncPeer.ConnectToService(47.96.69.160:10022)
Time: 2020/10/15 11:07:58 DEBUG: AsyncPeer.ServiceConnect()
Time: 2020/10/15 11:07:58 DEBUG: AsyncPeer.WaitConnection(172.24.224.1:58409)
Time: 2020/10/15 11:07:58 DEBUG: ClientWaitPeerConnectionCommand: 172.24.224.1|53324|User:81278742EBB8C17114312EA2DAF02AEB9EC198EB|Wangxf:81278742EBB8C17114312EA2DAF02AEB9EC198EB
Time: 2020/10/15 11:07:59 DEBUG: AsyncPeer.ConnectToPeer(Wangxf:81278742EBB8C17114312EA2DAF02AEB9EC198EB, 172.24.224.1:53324)
Time: 2020/10/15 11:07:59 DEBUG: ClientConnectToPeerCommand: Wangxf:81278742EBB8C17114312EA2DAF02AEB9EC198EB|172.24.224.1:53324
Time: 2020/10/15 11:07:59 DEBUG: AsyncPeer.PeerConnected(User:81278742EBB8C17114312EA2DAF02AEB9EC198EB)
Time: 2020/10/15 11:07:59 DEBUG: AsyncPeer.PeerConnected(Wangxf:81278742EBB8C17114312EA2DAF02AEB9EC198EB)
Time: 2020/10/15 11:10:41 DEBUG: Connecting directly to DJ:81278742EBB8C17114312EA2DAF02AEB9EC198EB...
Time: 2020/10/15 11:10:41 DEBUG: AsyncPeer.ConnectToPeer(DJ:81278742EBB8C17114312EA2DAF02AEB9EC198EB, 202.107.200.171:58081)
Time: 2020/10/15 11:10:41 DEBUG: ClientConnectToPeerCommand: DJ:81278742EBB8C17114312EA2DAF02AEB9EC198EB|202.107.200.171:58081
Time: 2020/10/15 11:12:20 DEBUG: AsyncPeer.WaitConnection(202.107.200.171:58081)
Time: 2020/10/15 11:12:20 DEBUG: ClientWaitPeerConnectionCommand: 36.23.115.101|20064|DJ:81278742EBB8C17114312EA2DAF02AEB9EC198EB|User:81278742EBB8C17114312EA2DAF02AEB9EC198EB
UnhandledError.log
Time: 2020/10/15 11:06:56;
Type: System.NullReferenceException;
Message: 未将对象引用设置到对象的实例。;
StackTrace:
在 Engine.Network.AsyncPeer.Finder.Equals(NetConnection connection) 位置 D:\Users\WXF\Source\Repos\TCPChat\Engine\Network\AsyncPeer.cs:行号 500
在 System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable1 source, Func
2 predicate)
在 Engine.Network.AsyncPeer.FindConnection(UserId id) 位置 D:\Users\WXF\Source\Repos\TCPChat\Engine\Network\AsyncPeer.cs:行号 485
在 Engine.Network.AsyncPeer.SendMessage(UserId peerId, IPackage package, Byte[] rawData, Boolean unreliable) 位置 D:\Users\WXF\Source\Repos\TCPChat\Engine\Network\AsyncPeer.cs:行号 312
在 Engine.Network.AsyncPeer.OnPeerConnected(NetIncomingMessage message) 位置 D:\Users\WXF\Source\Repos\TCPChat\Engine\Network\AsyncPeer.cs:行号 600
在 Engine.Network.AsyncPeer.OnReceive(Object obj) 位置 D:\Users\WXF\Source\Repos\TCPChat\Engine\Network\AsyncPeer.cs:行号 533
在 Engine.Helpers.EngineSyncContext.Event.Dispatch() 位置 D:\Users\WXF\Source\Repos\TCPChat\Engine\Helpers\EngineSyncContext.cs:行号 38
在 Engine.Helpers.EngineSyncContext.ThreadFunc(Object state) 位置 D:\Users\WXF\Source\Repos\TCPChat\Engine\Helpers\EngineSyncContext.cs:行号 123
在 System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
在 System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
在 System.Threading.ThreadPoolWorkQueue.Dispatch()
Server
Server.log
Time: 2020/10/15 11:05:36 WARNING: Connection : not found;
StackTrace:
在 Engine.Network.AsyncServer.GetConnection(UserId connectionId, Boolean allowTempConnections) 位置 D:\Users\WXF\Source\Repos\TCPChat\Engine\Network\AsyncServer.cs:行号 500
在 Engine.Network.AsyncServer.SendMessage(UserId connectionId, IPackage package, Boolean allowTempConnections) 位置 D:\Users\WXF\Source\Repos\TCPChat\Engine\Network\AsyncServer.cs:行号 277
在 Engine.Network.AsyncServer.SendMessage(UserId connectionId, Int64 id, Boolean allowTempConnections) 位置 D:\Users\WXF\Source\Repos\TCPChat\Engine\Network\AsyncServer.cs:行号 250
在 Engine.Api.Server.Others.ServerPingRequestCommand.OnRun(CommandArgs args) 位置 D:\Users\WXF\Source\Repos\TCPChat\Engine\Api\Server\Others\ServerPingRequestCommand.cs:行号 21
在 Engine.Api.Server.ServerCommand.Run(CommandArgs args) 位置 D:\Users\WXF\Source\Repos\TCPChat\Engine\Api\Server\ServerCommand.cs:行号 30
在 Engine.Network.RequestQueue.QueueContainer.Process(Object o) 位置 D:\Users\WXF\Source\Repos\TCPChat\Engine\Network\RequestQueue.cs:行号 79
在 System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
在 System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
在 System.Threading.ThreadPoolWorkQueue.Dispatch()
Time: 2020/10/15 11:05:39 INFO: User login: User:81278742EBB8C17114312EA2DAF02AEB9EC198EB
Time: 2020/10/15 11:06:48 INFO: User login: Wangxf:81278742EBB8C17114312EA2DAF02AEB9EC198EB
Time: 2020/10/15 11:07:46 INFO: User login: Wangxf:81278742EBB8C17114312EA2DAF02AEB9EC198EB
Time: 2020/10/15 11:10:13 INFO: User login: DJ:81278742EBB8C17114312EA2DAF02AEB9EC198EB
Originally posted by @Witchie in https://github.com/Nirklav/TCPChat/issue_comments/708874577