[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: Quick KOM/Corba Question
From:       Kurt Granroth <granroth () kde ! org>
Date:       1999-01-09 2:24:19
[Download RAW message or body]

Simon Hausmann wrote:
> Just to repeat it:
> There's no difference between the tutorial and "real" apps, you just need a
> proper reference to the objects you want to connect to.

Simon,

Thanks for your excellent explantion!  I've narrowed my problem now to the
above (and Torben hit the nail on the head in another post): I don't know
enough about CORBA to get a reference to another object.  So I've been
poring through the mico examples trying to get a feel for what is necessary.
Unfortunatly, it looks like KOM does quite a bit of stuff in the "background"
and I'm not entirely sure what.  I have the feeling that I *almost* have
it... but it doesn't quite work.  Here's the diluted version of what I have:

---------------------------------------------------------------
client_main.cc
---------------------------------------------------------------
int main( int argc, char **argv )
{
  KOMApplication app( argc, argv );
 
  CORBA::Object_var obj = app.orb()->bind("IDL:Signals:Receiver:1.0", argv[1]);
  assert (!CORBA::is_nil(obj));
  Signals::Receiver_var recv = Signals::Receiver::_narrow(obj);

  Signals::Sender_var sender = Signals::Sender::_duplicate( new Sender );
  sender->connect( "clicked", recv, "slotClicked" );

  sender->clicked();
  
  sender->destroy();
  sender = 0L;

  return 0;
}

---------------------------------------------------------------
server_main.cc
---------------------------------------------------------------
Now this is what is really confusing me.  I originally had something
like:

  if (!app.isRestoring())
  {
     Signals::Receiver_ptr recv = new Signals::Receiver_impl;
  }
 
  app.boa()->impl_is_ready(CORBA::ImplementationDef::_nil());
  app.orb()->run();

but that didn't work.  So I looked in the source a bit and found that
the 'isRestoring' and 'impl_is_ready' and stuff is all in
'KOMApplicaion::exec'.  However, it calls a virtual protected start()
function to actually create a new object.

So, I created a 'class KGServer : public KOMApplication' and reimplemented
	void start() {
		(void)new Signals::Receiver_var;
	}

and then

int main(int argc, char *argv[])
{
	KGServer app(argc, argv);

	return app.exec();
}

---------------------------------------------------------------
Result
---------------------------------------------------------------
I then did './server -ORBIIOPAddr inet:fastlane:16456' and
'./client inet:fastlane:16456'... and it didn't work :-(

To you CORBA/KOM experts out there, what boneheaded thing am I doing
wrong?  It feels like I'm close... Help :-)
-- 
Kurt Granroth
granroth@kde.org
http://www.pobox.com/~kurt_granroth

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic