int main(int argc, char *argv[]) { Network yarp; RpcServer server; server.promiseType(Type::byNameOnWire("rospy_tutorials/AddTwoInts")); if (!server.open("/add_two_ints@/yarp_add_int_server")) { fprintf(stderr,"Failed to open port\n"); return 1; } while (true) { Bottle msg, reply; if (!server.read(msg,true)) continue; int x = msg.get(0).asInt32(); int y = msg.get(1).asInt32(); int sum = x + y; reply.addInt32(sum); printf("Got %d + %d, answering %d\n", x, y, sum); server.reply(reply); } return 0; }