How can I catch the Ice::ConnectionLostException in bi_dir server?

in Help Center
Hello.
To test the bi_dir. when I shutdown the communicator from client. the server will show a waring :TcpTransceiver.cpp:275: Ice:ConnectionLostException.
I want to catch the exception in my program, so I can deal with some clean works. How can I do it?
Thanks.
To test the bi_dir. when I shutdown the communicator from client. the server will show a waring :TcpTransceiver.cpp:275: Ice:ConnectionLostException.
I want to catch the exception in my program, so I can deal with some clean works. How can I do it?
Thanks.
0
Comments
Even if this was possible, I wouldn't recommend relying on the closure of the network connection for the server to do some cleanup when the client goes away: this might work if you use bi-dir but this wouldn't work anymore if you decide to use Glacier2 between your server and client for example.
A better aproach is to use explicit sessions between the server and client. Take a look at the demo/Ice/session demo and the Ice newsletters for more information on sessions.
Benoit.
When I try this I get in the server:
adding client `e61fb1c4-d757-4bb5-bf41-4a37130937a5'
removing client `e61fb1c4-d757-4bb5-bf41-4a37130937a5':
c:\src\vc60\stage\Ice-2.1.2\src\ice\Outgoing.cpp:415: Ice::UnknownLocalException
:
unknown local exception:
c:\src\vc60\stage\Ice-2.1.2\src\ice\ConnectionFactory.cpp:446: Ice::Communicator
DestroyedException:
communicator object destroyed
Which doesn't match what you are saying. What exactly are you doing? Can you provide an example that demonstrates the problem?