c++ubuntu-16.04omniorb

Ask values with omniorb client


following a thread in this forum i got the solution for this tutorial: http://www.yolinux.com/TUTORIALS/CORBA.html But now i want to do something more. I want to do some kind of game, for 2 or more players (clients). But i dont know if omniorb allows me to send values via client program. The game consist in writing a comment like "throw" on client side and generate a random integer number and if the total sum=>60 wins. My question basically is if client can catch a keyboard input, and if its more efficient doing all process (generate random and sum) on client or in other class/file. Like always thank you in advance. Cheers!


Solution

  • Well, after a little search i found what i need. Basically i wanted ask for something (string or whatever). Im putting my code, its a cpp file btw.

    PedidoServicioA peticionA;  // Constructor establishes the link with     the CORBA server.
    std::string opcion;
    while(opcion!=":salir"){
    std::cout << "Introduzca ':lanzar' para tirar el dado o ':salir' para terminar la conexion" << endl;
    std::getline(std::cin,opcion);
    
        if(opcion==":salir"){
        std::cout << "Adios!" << endl;}
        else
        {
        if(peticionA.PedidoServLanzar()!=0) cout << "ServicioA Lanzar: En accion"     << endl;
        if(peticionA.PedidoServSuma()!=0) cout << "ServicioA Sumar: En accion"    << endl;
        }
    }
    

    Well, as you can see all outputs are in spanish but well is just comments. Thx a lot for your help. Other thing, can i declare global variables doing OO programing on c++? Coz i cant make an adition, everytime i run it adition value is 0 again.