Archived

This forum has been archived. Please start a new discussion on GitHub.

the problem of Ice::ConnectTimeoutException

The ice client can not get the proxy when the ice server run a long time. The tcp port is in listen state. And can telnet but the the return string is unnormer.

This picture show the telnet output when the ice server ok.
Attachment not found.

this show unnormal.
Attachment not found.

Attachment not found.

Attachment not found.

Comments

  • reboot the ice client can not resolve the problem.
    reboot the ice server can resolve the problem.

    the serersid initial code:

    //设置Ice属性
    //Get the initialized propert set
    Ice::PropertiesPtr props = Ice::createProperties(argc, argv);
    //Set the size of the server's thread pool
    props->setProperty("Ice.ThreadPool.Server.Size", "5");
    props->setProperty("Ice.ThreadPool.Server.SizeMax", "200");
    props->setProperty("Ice.ThreadPool.Server.ThreadIdleTime", "10");
    props->setProperty("Ice.MessageSizeMax", "2048000");
    props->setProperty("Ice.Override.ConnectTimeout", "10000"); // 连接建立的超时时间是10秒
    props->setProperty("Ice.Override.Timeout", "120000"); // 调用的超时时间是120秒
    props->setProperty("Ice.RetryIntervals", "-1"); // 禁止重试
    //Initialize a communicator with these properties
    Ice::InitializationData id;
    id.properties = props;

    CFile850App app;
    int ret = app.main(argc, argv, id);

    the client get proxy code:

    bool CShandong850I::is_connected()
    {
    try
    {
    string strUri = "IedFile:default -h 127.0.0.1 -p 10012";
    Ice::ObjectPrx objPrx = Ice::Application::communicator()->stringToProxy(strUri);
    iedFilePrx filePrx= iedFilePrx::checkedCast(objPrx);
    if(filePrx == NULL)
    {
    return false;
    }

    string ip = (m_ied.valid_ip_no == 1)? m_ied.ip1 : m_ied.ip2;
    int32_t port = (m_ied.valid_ip_no == 1)? m_ied.port1 : m_ied.port2;
    bool ret = filePrx->connected(ip, port);
    return ret;
    }
    catch(Ice::LocalException& e)
    {
    m_log.WriteALog(e.what());
    if(strstr(e.what(), "ConnectTimeoutException") != NULL)
    {
    kill_file850_program();
    }
    return false;
    }
    catch(Ice::Exception& e)
    {
    m_log.WriteALog(e.what());
    return false;
    }
    catch(...)
    {
    m_log.WriteALog("readFiles: unknown exception");
    return false;
    }
    return false;
    }

    the exception message:

    2016-04-15 05:40:41.932 ConnectionI.cpp:1619: Ice::ConnectTimeoutException:
    timeout while establishing a connection
  • bernard
    bernard Jupiter, FL
    Hi,

    The code above is not complete so it's hard to spot the problem. In particular, you don't show the object adapter of your server nor the configuration of this object adapter.

    In order to debug this connection problem, I suggest you start both your client and server with --Ice.Trace.Network=2, then post the output if you can't identify the issue.

    Best regards,
    Bernard