[omniORB] Cannot get the name of this host. - gethostname() fails ?

Martin B. 0xCDCDCDCD at gmx.at
Fri Nov 27 08:43:32 GMT 2009


Martin B. wrote:
> Hi there!
> 
> We have a Windows XP PC where we have installed omniORB 4.1.2 and when 
> we try to start omniNames, the following message is printed out and then 
> omninames terminates: (that's what they told me on the phone, so it may 
> not be accurate char for char)
> <date>:
> Error: cannot get the name of this host.
> 

The exact error message is:
<date>

Error: cannot get the name of this host.

> Searching for "Cannot get the name of this host." in the omniORB sources 
> it seems this is printed when gethostname() fails (tcpEndpoint.cc:565).
> 

It is not from tcpEndpoint, bt it is generated in 
src\appl\omniNames\log.cc:239 by this code:
     DWORD machineName_len = MAX_COMPUTERNAME_LENGTH;
     CORBA::String_var machineName = CORBA::string_alloc(machineName_len);
     if (!GetComputerName((LPTSTR)(char*)machineName, &machineName_len)) {
       cerr << ts.t() << "Error: cannot get the name of this host." << endl;
       exit(1);
     }

> 
> ANY ideas what might be broken here?
> 
> 

The problem is that GetComputerName must be passed 
MAX_COMPUTERNAME_LENGTH + 1(!) length for long computernames.

I have checked and the fix is already in omniORB since Sep.2008 so I 
guess that's a good opportunity to upgrade to a newer omniORB version.

br,
Martin



More information about the omniORB-list mailing list