Open qcjxberin opened 7 years ago
Hello! With google translate i understood that chat will not work in different subnets. Does it not work with client-client or server-client? Can you give an example with addresses?
在不同的子网之间到底能不能用啊?
Yes, it work from different subnets, but server should be started with public ip. (Public for all clients). If you have problems with connecting clients to public server, please write net configuration in this topic.
Is this project working when the clients after NATed by ISP?
@dextercai yes, chat should work when clients under NAT. But full cone not isn't supported, maybe some another NAT's aren't supported too. I've tested situation when client under NAT, but what type of NAT i've tested i don't know.
在不同的子网之间 聊天功能可以使用,但是 传输文件是传输不成的,我测试了很多次都不可以。 in different subnet,server started with public ip,i test result is chat function work correctly!but trans file cannot be use! another client can receive file request message!but can't download it!
@Witchie hey! That was happend because file transfer works with P2P, and clients can't connect with each other. If you have debug build, then logs will being written when you will try transfer files. Can you send that both clients and server logs to me?
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
这个在不同子网之间不能使用吧