#include #include #include #include #include "hello.h" #define IDFileName "hello.ior" int main(int argc, char *argv[]) { /* helloobject */ hello helloer; /* ORB */ CORBA_Environment ev; CORBA_ORB orb; /* ServerIDstring */ char idstring[1024]; FILE *idstringfile; /* helper variables */ CORBA_long l, key, locking; int ok, comm; char iline[81]; char *reply; /* init ORB */ CORBA_exception_init(&ev); orb = CORBA_ORB_init(&argc, argv, "orbit-local-orb", &ev); /* read server id */ if (! (idstringfile = fopen(IDFileName, "r"))) { printf("No ID file %s!\n", IDFileName); exit(-1); } fgets(idstring, 1024, idstringfile); fclose(idstringfile); /* make contact */ helloer = CORBA_ORB_string_to_object(orb, idstring, &ev); if (! helloer) { printf("Server not found!\n"); exit(-1); } printf("Give messs "); scanf("%s", iline); reply = hello_hi(helloer, iline, &ev); printf("Server sent %s\n", reply); /* shutdown orb */ CORBA_Object_release(helloer, &ev); CORBA_Object_release((CORBA_Object)orb, &ev); exit(0); }