From b07593b336ef6c4328c67abd330eac3648d42e60 Mon Sep 17 00:00:00 2001
From: Andrew Tridgell <andrew@tridgell.net>
Date: Mon, 22 Jun 2015 14:54:28 +1000
Subject: [PATCH] fixed incorrect use of gethostbyaddr()

---
 src/input_output/FGfdmSocket.cpp | 18 ++----------------
 1 file changed, 2 insertions(+), 16 deletions(-)

diff --git a/src/input_output/FGfdmSocket.cpp b/src/input_output/FGfdmSocket.cpp
index e6e40a0..9fda62d 100644
--- a/src/input_output/FGfdmSocket.cpp
+++ b/src/input_output/FGfdmSocket.cpp
@@ -72,17 +72,9 @@ FGfdmSocket::FGfdmSocket(const string& address, int port, int protocol)
     else cout << "Winsock DLL not initialized ..." << endl;
   #endif
 
-  if (!is_number(address)) {
     if ((host = gethostbyname(address.c_str())) == NULL) {
-      cout << "Could not get host net address by name..." << endl;
-    }
-  } else {
-    unsigned int ip;
-    ip = inet_addr(address.c_str());
-    if ((host = gethostbyaddr((char*)&ip, address.size(), PF_INET)) == NULL) {
-      cout << "Could not get host net address by number..." << endl;
+        cout << "Could not get host net address by name..." << endl;
     }
-  }
 
   if (host != NULL) {
     if (protocol == ptUDP) {  //use udp protocol
@@ -132,14 +124,8 @@ FGfdmSocket::FGfdmSocket(const string& address, int port)
   cout << "Host name...   " << address << ",  Port...  " << port << "." << endl;
   cout << "Host name... (char)  " << address.c_str() << "." << endl;
 
-  if (!is_number(address)) {
-    if ((host = gethostbyname(address.c_str())) == NULL) {
+  if ((host = gethostbyname(address.c_str())) == NULL) {
       cout << "Could not get host net address by name..." << endl;
-    }
-  } else {
-    if ((host = gethostbyaddr(address.c_str(), address.size(), PF_INET)) == NULL) {
-      cout << "Could not get host net address by number..." << endl;
-    }
   }
 
   if (host != NULL) {
-- 
GitLab