Proxy Endpoint Server
This sample demonstrates a server exposing a proxy endpoint, allowing clients to connect to a destination server.
#include <iostream>
#include <RCF/RCF.hpp>
#include <RCF/ProxyEndpoint.hpp>
RCF_BEGIN(I_PrintService, "I_PrintService")
RCF_METHOD_V1(void, Print, const std::string &)
RCF_END(I_PrintService)
int main()
{
try
{
std::string printServerName = "RoamingPrintSvr";
bool done = false;
while ( !done )
{
std::vector<std::string> proxyEndpoints;
for ( auto proxyEndpoint : proxyEndpoints )
{
if ( proxyEndpoint == printServerName )
{
{
std::cout << "In-process connection to proxy endpoint '" << printServerName << "'.";
client.Print("Calling I_PrintService through a proxy endpoint");
}
{
std::cout << "Out-of-process connection to proxy endpoint '" << printServerName << "'.";
client.Print("Calling I_PrintService through a proxy endpoint");
}
done = true;
}
}
}
}
{
}
return 0;
}
Destination Server
This sample demonstrates a destination server receiving calls through a proxy endpoint.
#include <iostream>
#include <RCF/RCF.hpp>
#include <RCF/ProxyEndpoint.hpp>
RCF_BEGIN(I_PrintService, "I_PrintService")
RCF_METHOD_V1(void, Print, const std::string &)
RCF_END(I_PrintService)
class PrintService
{
public:
void Print(const std::string & s)
{
std::cout << "I_PrintService service: " << s << std::endl;
}
};
int main()
{
try
{
std::string printServerName = "RoamingPrintSvr";
PrintService printService;
server.
bind<I_PrintService>(printService);
std::cout << "Press Enter to exit..." << std::endl;
std::cin.get();
}
{
}
return 0;
}