server's method get called twice while client received a TimeoutException

in Help Center
Hi :
I have modified the demo project hello's source code , and after some test I found a wierd problem.
In function sayHello of HelloI.cpp in server side
at the client side:
If I set _delay in server side to 5000 ms , and in my client's code, I set the hello proxy's timeout to 2000. we'll see that the same index will appear twice on server side's console.
That is , if client detected server timed out , it'll invoke the routine again.
attached is a screen shot and the zip of source code.
I have modified the demo project hello's source code , and after some test I found a wierd problem.
In function sayHello of HelloI.cpp in server side
int HelloI::sayHello(int index, const Ice::Current&) const { cout<<"call's index = "<<index<<endl;//display index passed from client IceUtil::ThreadControl::sleep( IceUtil::Time::milliSeconds( _delay ));//_delay is a pre-set value return 1; }
at the client side:
int iCount = 0; while(!bQuit) { try { cout<<"call's index = "<<iCount <<endl; hPrx->sayHello(iCount);//call server's hello and tell it current index } catch( const Ice::Exception& ex) { cout<<ex.ice_name()<<endl; } iCount ++; }
If I set _delay in server side to 5000 ms , and in my client's code, I set the hello proxy's timeout to 2000. we'll see that the same index will appear twice on server side's console.
That is , if client detected server timed out , it'll invoke the routine again.
attached is a screen shot and the zip of source code.
0
Comments
Michi.
See the section "Idempotent Operations" here in the Ice manual for more information.
Cheers,
Benoit.
Cheers,
Michi.
Thank you very much for your explanation