summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorDwayne Boone <dwayne@zeroc.com>2006-03-14 14:02:14 +0000
committerDwayne Boone <dwayne@zeroc.com>2006-03-14 14:02:14 +0000
commit0593f7a7f3c2fde9057d331ae45af4014f72678d (patch)
tree1f4c67812cb57c9a458927986d8a5f0a68296a6c /cpp/src
parentFixed Windows compile error (diff)
downloadice-0593f7a7f3c2fde9057d331ae45af4014f72678d.tar.bz2
ice-0593f7a7f3c2fde9057d331ae45af4014f72678d.tar.xz
ice-0593f7a7f3c2fde9057d331ae45af4014f72678d.zip
Removed getLocalHost
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Ice/Network.cpp88
-rw-r--r--cpp/src/Ice/Network.h1
2 files changed, 0 insertions, 89 deletions
diff --git a/cpp/src/Ice/Network.cpp b/cpp/src/Ice/Network.cpp
index b2d7aeed845..949cbd23be4 100644
--- a/cpp/src/Ice/Network.cpp
+++ b/cpp/src/Ice/Network.cpp
@@ -854,94 +854,6 @@ IceInternal::getAddress(const string& host, int port, struct sockaddr_in& addr)
}
}
-string
-IceInternal::getLocalHost(bool numeric)
-{
- char host[1024 + 1];
- if(gethostname(host, 1024) == SOCKET_ERROR)
- {
- SyscallException ex(__FILE__, __LINE__);
- ex.error = getSystemErrno();
- throw ex;
- }
-
-#ifdef _WIN32
-
- //
- // Windows XP has getaddrinfo(), but we don't want to require XP to run Ice.
- //
-
- //
- // gethostbyname() is thread safe on Windows, with a separate hostent per thread
- //
- struct hostent* entry;
- int retry = 5;
- do
- {
- entry = gethostbyname(host);
- }
- while(entry == 0 && WSAGetLastError() == WSATRY_AGAIN && --retry >= 0);
-
- if(entry == 0)
- {
- DNSException ex(__FILE__, __LINE__);
- ex.error = WSAGetLastError();
- ex.host = host;
- throw ex;
- }
-
- if(numeric)
- {
- struct sockaddr_in addr;
- memset(&addr, 0, sizeof(struct sockaddr_in));
- memcpy(&addr.sin_addr, entry->h_addr, entry->h_length);
- return inetAddrToString(addr.sin_addr);
- }
- else
- {
- return string(entry->h_name);
- }
-
-#else
-
- struct addrinfo* info = 0;
- int retry = 5;
-
- struct addrinfo hints = { 0 };
- hints.ai_family = PF_INET;
-
- int rs = 0;
- do
- {
- rs = getaddrinfo(host, 0, &hints, &info);
- }
- while(info == 0 && rs == EAI_AGAIN && --retry >= 0);
-
- if(rs != 0)
- {
- DNSException ex(__FILE__, __LINE__);
- ex.error = rs;
- ex.host = host;
- throw ex;
- }
-
- string result;
- if(numeric)
- {
- assert(info->ai_family == PF_INET);
- struct sockaddr_in* sin = reinterpret_cast<sockaddr_in*>(info->ai_addr);
- result = inetAddrToString(sin->sin_addr);
- }
- else
- {
- result = info->ai_canonname;
- }
- freeaddrinfo(info);
- return result;
-
-#endif
-}
-
bool
IceInternal::compareAddress(const struct sockaddr_in& addr1, const struct sockaddr_in& addr2)
{
diff --git a/cpp/src/Ice/Network.h b/cpp/src/Ice/Network.h
index 9d970790036..1cefec208a1 100644
--- a/cpp/src/Ice/Network.h
+++ b/cpp/src/Ice/Network.h
@@ -99,7 +99,6 @@ ICE_API void doConnect(SOCKET, struct sockaddr_in&, int);
ICE_API SOCKET doAccept(SOCKET, int);
ICE_API void getAddress(const std::string&, int, struct sockaddr_in&);
-ICE_API std::string getLocalHost(bool);
ICE_API bool compareAddress(const struct sockaddr_in&, const struct sockaddr_in&);
ICE_API void createPipe(SOCKET fds[2]);