Home Help Center

Question about client connecting with the server that is on deferent network sections

WangChenWangChen Member Chen WangOrganization: JiaoTong University,Beijing,ChinaProject: Network Management System
Hi,
I did a test with the hello project in democs of IceCS-3.1.0. I put the client side on 192.168.10.230,win2000 and the server side on 192.168.6.233,win2003. As a result, it is very slow to connect with the server.
I find some code in Network.cs of Ice project in IceCS-3.1.0 solution as follows:
public static string getNumericHost(string hostname)
{
int retry = 5;

repeatGetHostByName:
string numericHost;
try
{
#if ICE_DOTNET_1X
numericHost = Dns.GetHostByName(hostname).AddressList[0].ToString();
#else
numericHost = Dns.GetHostEntry(hostname).AddressList[0].ToString();
#endif
}
catch(Win32Exception ex)
{
if(ex.NativeErrorCode == WSATRY_AGAIN && --retry >= 0)
{
goto repeatGetHostByName;
}
Ice.DNSException e = new Ice.DNSException("address lookup failed", ex);
e.host = hostname;
throw e;
}
catch(System.Exception ex)
{
Ice.DNSException e = new Ice.DNSException("address lookup failed", ex);
e.host = hostname;
throw e;
}
return numericHost;
}

The reason for the problem is that when the client runs at "Dns.GetHostEntry(hostname).AddressList[0].ToString() " ,here hostname="192.168.6.233",it should wait for a while and then throws an Win32Exception about Host not found,No such host is known.

The problem didn't come out when the client and server in the same section or with c++ client.

what should I do for this?Could you help me how to solve this problem?Thanks.

Comments

  • michimichi Member Michi HenningOrganization: Triodia TechnologiesProject: I have a passing interest in Ice :-) ✭✭✭
    Hmmm...

    This looks like some sort of DNS configuration problem. What exactly are you seeing? Does the client eventually connect successfully, and it's just slow, or does it get an exception?

    Could you run client and server with Ice.Trace.Network=3 and provide the output? Are you sure that your DNS is configured correctly? What happens when you run nslookup in a command shell and look up the same addresses?

    Sorry to ask all these questions, but I need a bit more info to work out what's going wrong.

    Cheers,

    Michi.
  • WangChenWangChen Member Chen WangOrganization: JiaoTong University,Beijing,ChinaProject: Network Management System
    Ok,it is just slow when the client connecting to the server,then it eventually connect successfully.And also it send data to the server very quickly.

    In the icecs.dll source code. It throw an exception at Network.cs

    catch(Win32Exception ex)
    {
    if(ex.NativeErrorCode == WSATRY_AGAIN && --retry >= 0)
    {
    goto repeatGetHostByName;
    }
    Ice.DNSException e = new Ice.DNSException("address lookup failed", ex);
    e.host = hostname;
    throw e;
    }



    I set Ice.Trace.Network=3
    but there is nothing output before throw Ice.DNSException.
    When the client have connected the server ,the output is:

    [ client.exe: Network: trying to establish tcp connection to 192.168.6.233:10000
    ]
    [ client.exe: Network: tcp connection established
    local address = 192.168.10.230:2179
    remote address = 192.168.6.233:10000 ]
    [ client.exe: Network: received 14 of 14 bytes via tcp
    local address = 192.168.10.230:2179
    remote address = 192.168.6.233:10000 ]
    [ client.exe: Protocol: received validate connection
    message type = 3 (validate connection)
    compression status = 0 (not compressed; do not compress response, if any)
    message size = 14 ]
    [ client.exe: Protocol: sending request
    message type = 0 (request)
    compression status = 0 (not compressed; do not compress response, if any)
    message size = 56
    request id = 1
    identity = hello
    facet =
    operation = ice_isA
    mode = 1 (nonmutating)
    context = ]
    [ client.exe: Network: sent 56 of 56 bytes via tcp
    local address = 192.168.10.230:2179
    remote address = 192.168.6.233:10000 ]
    [ client.exe: Network: received 14 of 14 bytes via tcp
    local address = 192.168.10.230:2179
    remote address = 192.168.6.233:10000 ]
    [ client.exe: Network: received 12 of 12 bytes via tcp
    local address = 192.168.10.230:2179
    remote address = 192.168.6.233:10000 ]
    [ client.exe: Protocol: received reply
    message type = 2 (reply)
    compression status = 0 (not compressed; do not compress response, if any)
    message size = 26
    request id = 1
    reply status = 0 (ok) ]
    usage:
    t: send greeting as twoway
    o: send greeting as oneway
    O: send greeting as batch oneway
    d: send greeting as datagram
    D: send greeting as batch datagram
    f: flush all batch requests
    T: set a timeout
    S: switch secure mode on/off
    s: shutdown server
    x: exit
    ?: help

    ==>



    I run nslookup in cmd and then the output is
    Default Server: dialdns.bta.net.cn
    Address: 202.106.46.151


    I config two dns which are 202.106.46.151 and 202.106.0.20

    Thanks.
  • WangChenWangChen Member Chen WangOrganization: JiaoTong University,Beijing,ChinaProject: Network Management System
    The client.cs of hello project in democs.

    It is just slow when the client run at this code :

    HelloPrx twoway = HelloPrxHelper.checkedCast(
    communicator().stringToProxy(proxy).ice_twoway().ice_timeout(-1).ice_secure(false));


    because of it throws Ice.DNSException.

    However, it doesn't occur in c++ demo at the same code.
    HelloPrx twoway = HelloPrx::checkedCast(
    communicator()->stringToProxy(proxy)->ice_twoway()->ice_timeout(-1)->ice_secure(false));


    Thanks.
Sign In or Register to comment.