- rcf.zip
- RCF
- demo
- vs2003
- RCF
- doc
- include
- RCF
- SF
- license.txt
- src
- RCF
- SF
- test
- vs2003
- RCF
- RCF.sln
- RCF
- RCF.vcproj
- RCFTest
- RCFTest.vcproj
|
#include <string>
#include <boost/test/minimal.hpp>
#include <RCF/RCF.hpp>
#include <RCF/SessionInfo.hpp>
#include <RCF/util/CommandLine.hpp>
#include <RCF/util/PortNumbers.hpp>
class GetMyIp
{
public:
std::string getMyIp()
{
RCF::ClientInfo clientInfo = RCF::getCurrentSessionInfo().getClientInfo();
std::string ipAddr = clientInfo.getAddress();
sockaddr_in addr = clientInfo.getSockAddr();
return ipAddr;
}
};
RCF_BEGIN(I_GetMyIp, "I_GetMyIp")
RCF_METHOD_R0(std::string, getMyIp)
RCF_END(I_GetMyIp)
int test_main(int argc, char **argv)
{
util::CommandLineOption<int> port( "port", util::Ports::getNext(), "port number" );
util::CommandLine::getSingleton().parse(argc, argv);
RCF::RcfServer server(port);
server.bind<I_GetMyIp, GetMyIp>();
server.start();
std::string myIp = RcfClient<I_GetMyIp>("localhost", port).getMyIp();
BOOST_CHECK(myIp == "127.0.0.1");
return boost::exit_success;
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Software developer, from Sweden and now living in Canberra, Australia, working on distributed C++ applications. When he is not programming, Jarl enjoys skiing and playing table tennis. He derives immense satisfaction from referring to himself in third person.