version 1.26, 2005/02/06 21:13:14
|
version 1.27, 2005/03/08 02:54:34
|
|
|
struct hostent * phostent; | struct hostent * phostent; |
struct in_addr inaddr; | struct in_addr inaddr; |
String ipAddress = String::EMPTY; | String ipAddress = String::EMPTY; |
|
CString csName = hostName.getCString(); |
|
const char * ccName = csName; |
|
#ifndef PEGASUS_OS_OS400 |
|
if ((phostent = ::gethostbyname(ccName)) != NULL) |
|
#else |
if ((phostent = ::gethostbyname((const char *)hostName.getCString())) != NULL) | if ((phostent = ::gethostbyname((const char *)hostName.getCString())) != NULL) |
|
#endif |
{ | { |
::memcpy( &inaddr, phostent->h_addr,4); | ::memcpy( &inaddr, phostent->h_addr,4); |
#ifdef PEGASUS_PLATFORM_ZOS_ZSERIES_IBM | #ifdef PEGASUS_PLATFORM_ZOS_ZSERIES_IBM |
|
|
{ | { |
// resolve hostaddr to a real host entry | // resolve hostaddr to a real host entry |
// casting to (const char *) as (char *) will work as (void *) too, those it fits all platforms | // casting to (const char *) as (char *) will work as (void *) too, those it fits all platforms |
|
#ifndef PEGASUS_OS_OS400 |
entry = gethostbyaddr((const char *) &tmp_addr, sizeof(tmp_addr), AF_INET); | entry = gethostbyaddr((const char *) &tmp_addr, sizeof(tmp_addr), AF_INET); |
|
#else |
|
entry = gethostbyaddr((const char *) &tmp_addr, sizeof(tmp_addr), AF_INET); |
|
#endif |
if (entry == 0) | if (entry == 0) |
{ | { |
// error, couldn't resolve the ip | // error, couldn't resolve the ip |