readme

来自「编译工具」· 代码 · 共 68 行

TXT
68
字号
This example demonstrates the following features of omniORB and CORBA:  o  use of call-backs  o  use of threads for asynchronous processing  o  use of IDL modules  o  orderly shutdown of a server, cleaning up resourcesIt consists of three programs:  o  cb_server     -  a server application  o  cb_client     -  you'll never guess ...  o  cb_shutdown   -  initiates shutdown of the serverTo run the server:  $ ./cb_server  'IOR:3456098456.......345604598'To run a client, cut and paste the IOR from the server:  $ ./cb_client 'IOR:3456098456.......345604598'  cb_client: server->one_time(call_back, "Hello!")  cb_client: call_back("Hello!")  cb_client: Returned.In this example the server invokes the call-back object in the clientbefore returning.  You observe the CORBA calls as they occur in the ORBby passing the -ORBtraceInvocations 1 flag to your applications:  $ ./cb_client 'IOR:3456098456.......345604598' -ORBtraceInvocations 1  cb_client: server->one_time(call_back, "Hello!")  omniORB: Invoke 'one_time' on remote: root<0>  omniORB: Dispatching remote call 'call_back' to: root<0>  cb_client: call_back("Hello!")  cb_client: Returned.In a second mode of operation, the client registers the call-back withthe server, and waits for the server to make asynchronous call-backs.The server spawns a new thread to serve the client.  This server threadexits when the client goes away, or the server is shut down.  Note thatthis is not a very efficient way of serving many clients!The two additional arguments passed to the client are the pause in secondsbetween call-backs, and a time in seconds after which the client willexit:  $ ./cb_client 'IOR:3456098456.......345604598' 1 4  cb_client: server->register(call_back, "Hello!", 1)  cb_client: Returned.  cb_client: call_back("Hello!")  cb_client: call_back("Hello!")  cb_client: call_back("Hello!")  cb_client: Finished.Finally, the server may be asked to shut itself down cleanly.  This isdone as follows:  $ ./cb_shutdown 'IOR:3456098456.......345604598'Notice that the instance of server_i registered with the ORB is properlycleaned up.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?