Преглед на файлове

Tcp设置socket reuse,nodelay等参数

tanghai преди 8 години
родител
ревизия
828e3334a5
променени са 1 файла, в които са добавени 2 реда и са изтрити 0 реда
  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)
 		public TService(IPEndPoint ipEndPoint)
 		{
 		{
 			this.acceptor = new TcpListener(ipEndPoint);
 			this.acceptor = new TcpListener(ipEndPoint);
+			this.acceptor.Server.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
+			this.acceptor.Server.NoDelay = true;
 			this.acceptor.Start();
 			this.acceptor.Start();
 		}
 		}