tags:

views:

106

answers:

1

Hi, I am using RCF for Inter Process Communication in a project. Is there a way in RCF to create a bi directional channel. I will have server and client running in both processes. I was able to get one way commmunication working with Win32NamedPipes Here is the server

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;
}

Where MyService is the service it is implementing

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;
}

Suppose I have another service say "ClientService" running on client side. Is there a way to convert this server to client? I found some convertRCFClienttoSession function in RCF. I didn't find any examples for it.

A: 

Does this help?

Éric Malenfant
great.. thanks so much
Kamal