public int Run() { int c = 0; try { TTransport transport = new TSocket(Host, Port); TProtocol protocol = new TBinaryProtocol(transport); var client = new MultiplicationService.Client(protocol); Console.WriteLine("Thrift client opening transport to {0} on port {1} ...", Host, Port); transport.Open(); int a, b; Console.Write("Enter 1st integer : "); int.TryParse(Console.ReadLine(), out a); Console.Write("Enter 2nd integer : "); int.TryParse(Console.ReadLine(), out b); c = client.multiply(a, b); Console.WriteLine("{0} x {1} = {2}", a, b, c); Console.WriteLine("Thrift client closing transport ..."); transport.Close(); } catch (TApplicationException x) { Console.WriteLine(x.StackTrace); } return(c); }
static void Main(string[] args) { var transport = new TSocket("localhost", 9090); var protocol = new TBinaryProtocol(transport); var client = new MultiplicationService.Client(protocol); transport.Open(); var mult = client.multiply(2, 4); Console.WriteLine("mult: {0}", mult); }
public int Run() { int c = 0; try { TTransport transport = new TSocket(Host, Port); TProtocol protocol = new TBinaryProtocol(transport); var client = new MultiplicationService.Client(protocol); Console.WriteLine("Thrift client opening transport to {0} on port {1} ...", Host, Port); transport.Open(); int a, b; Console.Write("Enter 1st integer : "); int.TryParse(Console.ReadLine(), out a); Console.Write("Enter 2nd integer : "); int.TryParse(Console.ReadLine(), out b); c = client.multiply(a, b); Console.WriteLine("{0} x {1} = {2}", a, b, c); Console.WriteLine("Thrift client closing transport ..."); transport.Close(); } catch (TApplicationException x) { Console.WriteLine(x.StackTrace); } return c; }