Example #1
0
        static void Main(string[] args)
        {
#if SOCKET
            TTransport transport = new TSocket("localhost", 8080);
#else
            TTransport transport = new TNamedPipeClientTransport("MyPipeName");
#endif
            TProtocol         protocol = new TBinaryProtocol(transport);
            HelloWorld.Client client   = new HelloWorld.Client(protocol);

            transport.Open();
            String res = client.hoge("Send to Server");
            Console.WriteLine(res);
        }
        public static void runHelloWorldSocketExample()
        {
            TTransport transport = new TSocket("localhost", 9090);
            TProtocol protocol = new TBinaryProtocol(transport);
            HelloWorld.Client client = new HelloWorld.Client(protocol);

            transport.Open();

            client.ping();
            Console.WriteLine("ping()");

            string msg = client.sayHello();
            Console.WriteLine(msg);

            msg = client.sayMsg(Constants.HELLO_IN_KOREAN);
            Console.WriteLine(msg);

            HelloStruct hellostruct = client.structTest(Constants.HELLO_IN_JAPANESE);
            Console.WriteLine(hellostruct.Id);

            transport.Close();
        }