Listing 8: A YAMI client in YDL.

// a YAMI client built with YDL
#include "yami++.h"
#include "calc_client.h"

using namespace YAMI;
#include <iostream>
#include <string>
using namespace std;
const string serverhost = "127.0.0.1";
const int    serverport = 12340;
const int    clientport = 12341;
const string domainname  = "someDomain";
const string objectname  = "calculator";
int main()
{
    try
    {
        netInitialize();
        {
        Agent agent(clientport);
        agent.domainRegister(domainname,
            serverhost, serverport, 2);
        // create a local representative of the server        
        calculator calc(agent, domainname, objectname);
        int result;
        // send the message
        calc.multiply(5, 6, result);
        cout << "the result is: " << result << endl;
        }
        netCleanup();
    }
    catch (const exception &e)
    {
        cout << e.what() << endl;
    }
}