Home Help Center

A question about getting data

laoteelaotee Member ✭✭
Hi,
public void a
{
try{
        PCManger.GetData();
}
catch(Ice.ConnectFailedException)
{

}
}

		public Data GetData()
		{
		    return GetData(__defaultContext());
		}

		public Data GetData(Ice.Context __context)
		{
		    int __cnt = 0;
		    while(true)
		    {
			try
			{
			    __checkTwowayOnly("GetData");
			    Ice._ObjectDel __delBase = __getDelegate();
			    _PCManagerDel __del = (_PCManagerDel)__delBase;
			    return __del.GetData(__context);
			}
			catch(IceInternal.NonRepeatable __ex)
			{
			    __rethrowException(__ex.get());
			}
			catch(Ice.LocalException __ex)
			{
			    __cnt = __handleException(__ex, __cnt);
			}
		    }
		}
I execute function a.if it is not connected,the exception is thrown quickly sometimes,and sometimes I wait for a long time that it is thrown.why?
Config: win2000+.Net2003
thanks.

Comments

  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    It's difficult to answer your question without more information on your environment and the conditions of your tests. Are you trying to connect on a remote machine? or on the local machine? Are you using hostnames or IP addresses for the server?

    There's many things that can influence the time it takes for the connection establishment to fail (a DNS lookup failure, the machine hosting the server is down, the machine hosting the server is up but the server isn't running, etc).

    I recommend you to use the network tracing (with Ice.Trace.Network=2) to see what Ice is doing, this might help figuring out why the connection establishment takes time.

    Benoit.
  • laoteelaotee Member ✭✭
    Hi,benoit
    I said that the test is between two remote machines which are both online ,and the ICE Server exist in the machines .I find if I get data for a mechines that is not online, I shall spend more time waiting.
    thanks
  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Yes, that's probably expected. How long it takes for the connection establishment to fail is system dependant and depends one the reason of the failure.

    For example, on my Linux machine if I try to connect to a machine which is down, it takes about 6 seconds for the client to fail. If I try to connect to a machine which is up but no server is listening on the TCP/IP port, it takes less than a second for the client to fail. If I try to connect to a machine with a bogus DNS name, it takes about 1 second for the client to fail. You can probably observe the same times with any TCP/IP client, it's not specific to Ice.

    What is your concern with the time it takes for the connection establishment to fail? If you want to make sure the connection establishment won't take too long, you can set a timeout with Ice.Override.ConnectTimeout property (see the Ice manual for more information). If you suspect something is wrong with Ice, please provide us more information: the Ice version, the operating system, how long it takes for the connection establishment to fail (and under which conditions) and possibly a small example that we could use to duplicate the problem.

    Hope this helps!

    Benoit.
  • laoteelaotee Member ✭✭
    Hi ,benoit
    Thank for you help.
Sign In or Register to comment.