Browse Source

Tcp设置socket reuse,nodelay等参数

tanghai 8 năm trước cách đây
mục cha
commit
828e3334a5
1 tập tin đã thay đổi với 2 bổ sung0 xóa
  1. 2 0
      Unity/Assets/Scripts/Base/Network/TNet/TService.cs

+ 2 - 0
Unity/Assets/Scripts/Base/Network/TNet/TService.cs

@@ -19,6 +19,8 @@ namespace Model
 		public TService(IPEndPoint ipEndPoint)
 		{
 			this.acceptor = new TcpListener(ipEndPoint);
+			this.acceptor.Server.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
+			this.acceptor.Server.NoDelay = true;
 			this.acceptor.Start();
 		}