internal static void Run(int serverPort) { Socket server = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); server.Bind(new IPEndPoint(IPAddress.Any, serverPort)); server.Listen(5); while (true) { Socket client = server.Accept(); if (client == null) { break; } ServerTest.Run(new TcpSocket(client)); client.Close(); } server.Close(); }
internal static void Run(int port) { UdtSharp.UdtSocket server = new UdtSharp.UdtSocket(AddressFamily.InterNetwork, SocketType.Stream); server.Bind(new IPEndPoint(IPAddress.Any, port)); server.Listen(5); while (true) { UdtSharp.UdtSocket serverSocket = server.Accept(); if (serverSocket == null) { break; } ServerTest.Run(new UdtSocket(serverSocket)); serverSocket.Close(); } server.Close(); }