[omniORB] Single Login to server program

Muro, Sam research at businesstz.com
Sat Jul 31 18:54:18 BST 2010


Hi
I am trying to implement a corba program (client) to retrieve customer
information from the server. Since the server allow to login once and
perform your operations until the lifetime experies, i want the client to
use already login connection to perform the retrieve function without
login in to the server for every request.

Suppose retrieve has three functions, logon(), perform() and logoff()
Pseudo code;
1. User runs a client application
	./retrieve <corbaloc URI> customerID
2. if the client program has already login, donot login, go to 4
3. Client program login to the server program
4. client program invoke perform(customerID) to retrieve customer information
5. Client program submit customer information to the calling program, in
this case, stdio
6. Unless specified, do not logoff

Here is the code snippets;

static void login(Base::Customer_ptr e) {

  CORBA::String_var username = (const char*) "mimi";
  CORBA::String_var password = (const char*) "ahh!!";
  CORBA::String_var seckey= (const char*) "";
  Base::BaseList  BaseLists;

  BaseList.length(2);
  BaseList[0].bName =  CORBA::string_dup("CATEGORY");
  BaseList[0].bValue = CORBA::string_dup("VIP");

  BaseList[1].bName =  CORBA::string_dup("CATEGORY");
  BaseList[1].bValue = CORBA::string_dup("VIP");

//I JUST WANT TO PERFORM THIS FUNCTION IFF IT HASNT BEEN INVOKED BEFORE,
ELSE SKIP THIS METHOD
  e->Login(username,password,seckey); //NEW seckey WILL BE RETURNED

  Base::BaseResult result;
  result=  e-> Perform(seckey, BaseList);

  cerr  << "***********************************" <<endl
        << "****         TASK RESULT      *****" <<endl
        << "****     \t"<< taskresult << "  *****" <<endl
        << "***********************************" <<endl;

  //PERFORM THIS FUCTION ONLY IF NECESSARY, MAY CHECK argc[] for specified
option
 e-> logoff();

}

I also want to make this be multithreads.
Any input is highly appreciated

Sam



More information about the omniORB-list mailing list