[omniORB] Cannot get the name of this host. - gethostname() fails ?
Martin B.
0xCDCDCDCD at gmx.at
Thu Nov 26 17:23:49 GMT 2009
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.
Searching for "Cannot get the name of this host." in the omniORB sources
it seems this is printed when gethostname() fails (tcpEndpoint.cc:565).
I'm at a loss why this may fail. I have sent my colleague a short
testprogram and when he runs that on the machine, it correctly reports
the hostname. (Find the testprg below for reference)
We've set traceLevel:40 in the registry but he told me that there are
*no* trace loggings output by omninames, so maybe we didn't get that
right over the phone.
ANY ideas what might be broken here?
cheers,
Martin
## test code for gethostname() ##
-- main.cpp --
#include <winsock.h>
#define OMNIORB_HOSTNAME_MAX 512
int main()
{
WSADATA WSAData;
if( WSAStartup(MAKEWORD(1, 0), &WSAData) != 0) {
printf("WSA Startup failed!\n");
return 1;
}
char self[OMNIORB_HOSTNAME_MAX];
if (gethostname(&self[0],OMNIORB_HOSTNAME_MAX) == SOCKET_ERROR){
int err = ::WSAGetLastError();
printf("gethostname() failed! errorcode == %d\n", err);
}
else {
printf("gethostname() == %s\n", self);
}
WSACleanup();
return 0;
}
More information about the omniORB-list
mailing list