Просмотр исходного кода

Tcp设置socket reuse,nodelay等参数

tanghai 8 лет назад
Родитель
Сommit
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)
 		{
 			this.acceptor = new TcpListener(ipEndPoint);
+			this.acceptor.Server.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
+			this.acceptor.Server.NoDelay = true;
 			this.acceptor.Start();
 		}