BCB中Corba Name Service使用方法

http://tech.ddvip.com   2006年03月31日    社区交流

本文详细介绍BCB中Corba Name Service使用方法

  由于在尝试用BCB 4访问NameService时,遇到了一些奇奇怪怪的问题,而Visibroker所带的例子却可以用bcc32正常编译运行,俺决定从头做一个程序看看问题出在哪里。折腾了一夜,结论是做服务器还是不用Corba Server wizard好。(我还是不明白为什么?)

  1、File| New, Multitier,Corba IDL File:

  interface Order{
string Name();
};

  存为order.idl

  2、File|New, Consol Wizard,生成一个无vcl支持的consol应用。

  3、Project|Add to project,选上刚写的order.idl,Project | Compile之。

  4、File|New, Miltitier, Corba Object Implementation,IDL选刚写的order.idl,Interface选Order,为简明起见,其它的名字就不改了。确定,自动生成OrderServer.cpp。

  5、在OrderServer.cpp中找到char* OrderImpl::Name(),在其函数体中写:

  return "Hi, I am Test CorbaServer";

  6、File | Save All,Unit1.cpp存为tcnServer.cpp,Project存为tcnServer.bpr。然后Make之。一个简单的Corba Server就做好了。

  7、测试运行一下,然后在MS-Dos方式下运行osfind.exe(应该在path里,否则到$(VBroker)\bin里找),这时会显示一系列的corba信息:

  C:\>osfind
osfind: Found one agent at port 14000
     HOST: YANGWU
osfind: Found 1 OADs in your domain
HOST: YANGWU
osfind: Following are the list of Implementations registered with OADs.
     HOST: YANGWU
         REPOSITORY ID: IDL:CorbaTester/DBServer2Factory:1.0
             OBJECT NAME: DBServer2
osfind: Following are the list of Implementations started manually.
HOST: YANGWU
         REPOSITORY ID: IDL:Order:1.0
             OBJECT NAME: OrderObject
         REPOSITORY ID: IDL:visigenic.com/Activation/OAD:1.0
             OBJECT NAME: 61.132.58.166

责编:豆豆技术应用

正在加载评论...