English 中文(简体)
分散客户服务多重角色
原标题:Thrift client-server multiple roles

这是我的第一个问题,如果形式错的话,那是令人不安的。

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.

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.

任何建议?

感谢!

问题回答

考虑使用boost:asio供客户使用,尽管这部法典视你在C++的级别而定,但似乎过于密集。

If you re looking for a simple example, take a look at: http://www.linuxhowtos.org/C_C++/socket.htm

其中载有服务器和客户编码。 双方都制作了一个袖珍片和双向通信,每个方面都把数据张贴到桌面上。 服务器方面一般是多面的(每个连接有一对面)。 客户一方可以作为单一阅读的通道加以实施,在查询任何新信息、进行计算和将结果重新列表之间轮流使用。

由于你说,你对客户的电话职能有问题,这里是一份有 Java服务器和C++客户的彩色代码样本,客户在服务器上称职:

希望:





相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?

热门标签