public static void Run(int times, CancellationToken cancellationToken) { Parallel.For(0, times, i => { using (var socket = new TcpClient("localhost", 8005)) { using (var transport = new TSocketClientTransport(socket)) { using (TProtocol protocol = new TCompactProtocol(transport)) { using (var client = new IHelloWorldService.Client(protocol)) { transport.OpenAsync().Wait(); client.HelloWorldAsync(cancellationToken).Wait(); } } } } }); }
public static void Run(int times) { Parallel.For(0, times, i => { using (TSocket socket = new TSocket("localhost", 8005)) { using (TTransport transport = new TBufferedTransport(socket)) { using (TProtocol protocol = new TCompactProtocol(transport)) { using (var client = new IHelloWorldService.Client(protocol)) { transport.Open(); client.HelloWorld(); } } } } }); }