我在项目中使用RCF进行进程间通信。在RCF中是否有办法创建双向通道。我将在两个进程中运行服务器和客户端。我能够通过Win32NamedPipes获得单向通信。这是服务器
int main()
{
MyServiceImpl myServiceImpl;
RCF::RcfServer server;//(RCF::TcpEndpoint("0.0.0.0", 50001));
server.addServerTransport(boost::shared_ptr<RCF::I_ServerTransport>(new RCF::Win32NamedPipeServerTransport(("rcfchannel"))));
server.bind<MyService>(myServiceImpl);
server.bind<MyService>(myServiceImpl);
server.start();
server.waitForStopEvent();
return 0;
}
MyService正在实施的服务
Client.cpp
int main()
{
try
{
std::vector<std::string> v;
v.push_back("one");
v.push_back("two");
v.push_back("three");
std::cout << "Before:\n";
std::copy(
v.begin(),
v.end(),
std::ostream_iterator<std::string>(std::cout, "\n"));
RcfClient<MyService>* m_service = new RcfClient<MyService>(RCF::Win32NamedPipeEndpoint("rcfchannel"));
m_service->reverse(v);
std::cout << "\nAfter:\n";
std::copy(
v.begin(),
v.end(),
std::ostream_iterator<std::string>(std::cout, "\n"));
}
catch(const std::exception &e)
{
std::cout << "Caught exception:\n";
std::cout << "Type: " << typeid(e).name() << "\n";
std::cout << "What: " << e.what() << "\n";
}
return 0;
}
假设我有另一个服务说客户端运行“ClientService”。有没有办法将此服务器转换为客户端?我在RCF中找到了一些convertRCFClienttoSession函数。我没有找到任何例子。