internal static void Run(ClientArgs args) { UdtSharp.UdtSocket client = new UdtSharp.UdtSocket(AddressFamily.InterNetwork, SocketType.Stream); client.Connect(new IPEndPoint(args.ServerAddress, args.ServerPort)); try { switch (args.TestType) { case TestType.Upload: ClientTest.Upload(new UdtSocket(client), args.SizeInMb); break; case TestType.Download: ClientTest.Download(new UdtSocket(client), args.SizeInMb); break; case TestType.Integrity: ClientTest.Integrity(new UdtSocket(client), args.SizeInMb); break; } } finally { client.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(); }