Menu

#4 call of

open
nobody
None
5
2005-09-27
2005-09-27
No

IPAddress.cpp:
const IpAddress& IpAddress::getLocalIpAddress()
the following call
localIpAddress->set( Host::getLocalhost().getName() );
and the subsequent call of
long addr = ::inet_addr(string.c_str());
leads to an Network Error on all systems where the
hostname is not equivalent to the IP-Address.

Discussion

  • Gerard J. Cerchio

    Logged In: YES
    user_id=84983

    Thanks Herbert,

    I am not sure what you mean by "hostname is not equivalent
    to the IP-Address". What OS('s) are you performing this
    test on? How do I duplicate this error?

     
  • Herbert Danler

    Herbert Danler - 2005-09-28

    Logged In: YES
    user_id=578394

    Hello Gerard,

    I'm working on Windows XP in a company network. The host
    name (visible in system/computername) is a string, whereas
    the IP address is assigned via DHCP on startup.
    The call to Host::getLocalhost().getName() therefore results in
    a string like e.g. myhost.
    If that string is consecutively passed to inet_addr, which
    expects an IP-address, the described error occurs.

    The problem should therefore be easily reproducable in
    Windows environments.

    HTH

     
  • Gerard J. Cerchio

    Logged In: YES
    user_id=84983

    Hi Herbert,

    Thanks for the reply. sounds like the fix is pretty easy,
    if you are going to implement it will you send me the diff?
    If you are not going to implement it, please give let me
    know the error code that is being returned and I shall
    endeavor to make a patch.

    Gerard

     

Log in to post a comment.