CORBA : how does client poll from server?
I am a total newbie in CORBA. I have written a simple c++ CORBA CLIENT and a CORBA SERVER. I would like the client to ask a s开发者_JAVA技巧tatus from time to time from the server. However, I have no idea how to do that and my google searches give me no luck. Can anybody tell me how to perform polling of client to server? or perhaps how to catch notifications from server
The ability for a CORBA client to call/poll a method on a server is about as simple as CORBA development gets, and it's usually covered by the "Getting Started" section of an ORB's documentation. Here's a C++ Hello World
example online for both a client and a server.
If you want the client to call the same method periodically, it's up to you as the client programmer to make that happen. You can put the client calling thread to sleep for some time between calls, set the client process to be launched on a regular basis by cron
, whatever you prefer. CORBA won't initiate remote calls automatically for you. You have to instruct the CORBA layer to call the server on your behalf.
In addition to the answers above, you could also use the CORBA event or notification services to receive asynchronous notifications from a remote server to avoid polling.
And aside from polling, much more often client would provide object reference to one of its objects, and server would invoke a call on that object when something happens. That way polling could be completely avoided.
精彩评论