fixed compilation for windows (to be tested)

This commit is contained in:
csoler 2015-10-08 18:54:12 -04:00
parent e776effc0d
commit 4a4625e2bf

View File

@ -75,6 +75,9 @@ void sockaddr_clear(struct sockaddr_in *addr)
bool rsGetHostByName(const std::string& hostname, in_addr& returned_addr)
{
#ifdef WINDOWS_SYS
hostent *result = gethostbyname(hostname.c_str()) ;
#else
RsTemporaryMemory mem(8192) ;
if(!mem)
@ -92,9 +95,10 @@ bool rsGetHostByName(const std::string& hostname, in_addr& returned_addr)
std::cerr << __PRETTY_FUNCTION__ << ": cannot call gethostname_r. Internal error reported. Check buffer size." << std::endl;
return false ;
}
#endif
if(!result)
{
std::cerr << __PRETTY_FUNCTION__ << ": gethostname_r returned null result." << std::endl;
std::cerr << __PRETTY_FUNCTION__ << ": gethostname returned null result." << std::endl;
return false ;
}
// Use contents of result.