4

在我用 C# 编写的客户端中出现此错误。我的服务器在 python 中。这是我第一个使用 Thrift 的测试程序。看起来我的 python 服务器正在运行。这是我的客户代码。我在调用“Client.add(2,3)”时收到此错误

static void Main(string[] args)
    {
        try
        {
            var socket = new TSocket("localhost", 9089);
            var transport = new TBufferedTransport(socket);
            var protocol = new TBinaryProtocol(transport);
            var client = new CalculatorService.Client(protocol);
            transport.Open();
            if (transport.IsOpen)
            {
                //I am seeing this message
                Console.WriteLine("server is open for business");                    
            }
            Console.WriteLine(client.add(2, 3)); //this is the line that gives me the error
            transport.Close();
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.Message);
        }

任何帮助将不胜感激。

4

1 回答 1

2

尝试使用,

client.InputProtocol.Transport.Open();

代替,

transport.Open();

顺便说一句,我的服务器是基于 Java 的

于 2014-08-03T16:47:09.037 回答