Thrift客户端 - 服务器多个角色 [英] Thrift client-server multiple roles

查看:198
本文介绍了Thrift客户端 - 服务器多个角色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的第一个问题,所以很抱歉如果表单是错误的!

this is my first question, so sorry if the form is wrong!

我试图使thrift服务器(python)和客户端
但是我需要在两个方向交换消息。客户端应该注册(调用服务器的功能并等待),服务器应在同一端口侦听N(N-> 100k)传入连接(客户端)。满足一些条件后,服务器需要调用每个客户端上的函数并收集结果并解释它们。

I'm trying to make thrift server (python) and client (c++). However I need to exchange messages in both direction. Client should register (call server's function and wait), and server should listen on same port for N (N-> 100k) incoming connections (clients). After some conditions are satisfied, server needs to call functions on each client and collect results and interpret them.

我很困惑,第一个问题是这可以在Thrift做吗?
第二个问题与允许我双向通信的机制有关。我想我需要两个服务。一个与客户端的功能不同的服务器的。
但是我对调用代码感到困惑。我理解单向通信(从服务器调用功能),但从客户端调用功能我有一个问题。

I'm little confused, and first questions is "can this be done in Thrift"? Second question is related to mechanism that will allow me bidirectional communication. I guess that I will need two services. One with client's functions other with server's. But I'm confused with calling code. I understand one way communication (calling functions from server), but with calling functions from client side I have a problem.

任何建议?

谢谢!

推荐答案

因为,你说你从客户端调用函数有问题,这里是一个示例Thrift代码与Java服务器和C + +客户端,其中客户端调用服务器中的函数。 http://fundoonick.blogspot.com/2010 /06/sample-thrift-program-for-server-in.html

Since, you say you are having problem with calling functions from client side, here is a sample Thrift code with Java server and C++ client, where the client calls a function in server. http://fundoonick.blogspot.com/2010/06/sample-thrift-program-for-server-in.html

希望这有助于:)

这篇关于Thrift客户端 - 服务器多个角色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆