git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8545 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris
2008-05-23 20:56:24 +00:00
parent d2290cfa3a
commit 00654d880e
338 changed files with 55725 additions and 19400 deletions

View File

@@ -1,4 +1,11 @@
#include <cassert>
#include <stdexcept>
#include <iostream>
#ifdef WIN32
# include <windows.h>
#else
# include <unistd.h>
#endif
#include <xmlrpc-c/base.hpp>
#include <xmlrpc-c/registry.hpp>
@@ -6,6 +13,13 @@
using namespace std;
#ifdef WIN32
#define SLEEP(seconds) SleepEx(seconds * 1000);
#else
#define SLEEP(seconds) sleep(seconds);
#endif
class sampleAddMethod : public xmlrpc_c::method {
public:
sampleAddMethod() {
@@ -26,6 +40,11 @@ public:
paramList.verifyEnd(2);
*retvalP = xmlrpc_c::value_int(addend + adder);
// Sometimes, make it look hard (so client can see what it's like
// to do an RPC that takes a while).
if (adder == 1)
SLEEP(2);
}
};
@@ -35,21 +54,24 @@ int
main(int const,
const char ** const) {
xmlrpc_c::registry myRegistry;
try {
xmlrpc_c::registry myRegistry;
xmlrpc_c::methodPtr const sampleAddMethodP(new sampleAddMethod);
myRegistry.addMethod("sample.add", sampleAddMethodP);
xmlrpc_c::serverAbyss myAbyssServer(
myRegistry,
8080, // TCP port on which to listen
"/tmp/xmlrpc_log" // Log file
);
myAbyssServer.run();
// xmlrpc_c::serverAbyss.run() never returns
assert(false);
xmlrpc_c::methodPtr const sampleAddMethodP(new sampleAddMethod);
myRegistry.addMethod("sample.add", sampleAddMethodP);
xmlrpc_c::serverAbyss myAbyssServer(
myRegistry,
8080, // TCP port on which to listen
"/tmp/xmlrpc_log" // Log file
);
myAbyssServer.run();
// xmlrpc_c::serverAbyss.run() never returns
assert(false);
} catch (exception const& e) {
cerr << "Something failed. " << e.what() << endl;
}
return 0;
}