Home Help Center

At client site, how to set the timeout parameter for remote call?

JiangyubaoJiangyubao Member Yubao JiangOrganization: www.gliet.edu.cnProject: integrate OSGi & Ice to provice service for PHP ✭✭
Hi, all.

For example, I deploy a server application, and the service method is:

void hello(){
Thread.sleep(20000);//sleep 20 s
}

I use a client to connect to the server, and invoke the method, and I want to set the timeout parameter:
if this call is not return in 1000ms, abandon this call, or throw a runtime exception.

How to resolve this problem?

Thanks!

Comments

  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi,

    You need to set a timeout on the proxy:
       // C++
       proxy = proxy->ice_timeout(1000);
       proxy->hello();
    

    See the Ice manual for more information on timeouts.

    Cheers,
    Benoit.
  • JiangyubaoJiangyubao Member Yubao JiangOrganization: www.gliet.edu.cnProject: integrate OSGi & Ice to provice service for PHP ✭✭
    Thanks for your reply.
    I have found it.

    Thanks!
  • JiangyubaoJiangyubao Member Yubao JiangOrganization: www.gliet.edu.cnProject: integrate OSGi & Ice to provice service for PHP ✭✭
    Hi, how much is the default value of this timeout parameter?
  • michimichi Member Michi HenningOrganization: Triodia TechnologiesProject: I have a passing interest in Ice :-) ✭✭✭
    See "Connection Timeouts" in the manual. The default is no timeout.

    Cheers,

    Michi.
Sign In or Register to comment.