]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/input_output/FGfdmSocket.cpp
latest changes for JSBSim (1.0 prerelease)
[flightgear.git] / src / FDM / JSBSim / input_output / FGfdmSocket.cpp
index 0797b69fcd154b5d912b7edc712b68099d9b4e46..7fa7ae59fbc7678d646c93adf943030f68bd4de5 100644 (file)
@@ -55,7 +55,7 @@ FGfdmSocket::FGfdmSocket(string address, int port, int protocol)
   sckt = sckt_in = size = 0;
   connected = false;
 
-  #if defined(__BORLANDC__) || defined(_MSC_VER) || defined(__MINGW32__)
+  #if defined(_MSC_VER) || defined(__MINGW32__)
     WSADATA wsaData;
     int wsaReturnCode;
     wsaReturnCode = WSAStartup(MAKEWORD(1,1), &wsaData);
@@ -63,7 +63,7 @@ FGfdmSocket::FGfdmSocket(string address, int port, int protocol)
     else cout << "Winsock DLL not initialized ..." << endl;
   #endif
 
-  if (address.find_first_not_of("0123456789.",0) != address.npos) {
+  if (!is_number(address)) {
     if ((host = gethostbyname(address.c_str())) == NULL) {
       cout << "Could not get host net address by name..." << endl;
     }
@@ -109,7 +109,7 @@ FGfdmSocket::FGfdmSocket(string address, int port)
   sckt = sckt_in = size = 0;
   connected = false;
 
-  #if defined(__BORLANDC__) || defined(_MSC_VER) || defined(__MINGW32__)
+  #if defined(_MSC_VER) || defined(__MINGW32__)
     WSADATA wsaData;
     int wsaReturnCode;
     wsaReturnCode = WSAStartup(MAKEWORD(1,1), &wsaData);
@@ -121,7 +121,7 @@ FGfdmSocket::FGfdmSocket(string address, int port)
   cout << "Host name...   " << address << ",  Port...  " << port << "." << endl;
   cout << "Host name... (char)  " << address.c_str() << "." << endl;
 
-  if (address.find_first_not_of("0123456789.",0) != address.npos) {
+  if (!is_number(address)) {
     if ((host = gethostbyname(address.c_str())) == NULL) {
       cout << "Could not get host net address by name..." << endl;
     }
@@ -162,7 +162,7 @@ FGfdmSocket::FGfdmSocket(int port)
   connected = false;
   unsigned long NoBlock = true;
 
-  #if defined(__BORLANDC__) || defined(_MSC_VER) || defined(__MINGW32__)
+  #if defined(_MSC_VER) || defined(__MINGW32__)
     WSADATA wsaData;
     int wsaReturnCode;
     wsaReturnCode = WSAStartup(MAKEWORD(1,1), &wsaData);
@@ -180,7 +180,7 @@ FGfdmSocket::FGfdmSocket(int port)
     if (bind(sckt, (struct sockaddr*)&scktName, len) == 0) {   // successful
       cout << "Successfully bound to socket for input on port " << port << endl;
       if (listen(sckt, 5) >= 0) { // successful listen()
-        #if defined(__BORLANDC__) || defined(_MSC_VER) || defined(__MINGW32__)
+        #if defined(_MSC_VER) || defined(__MINGW32__)
           ioctlsocket(sckt, FIONBIO, &NoBlock);
           sckt_in = accept(sckt, (struct sockaddr*)&scktName, &len);
         #else
@@ -205,14 +205,8 @@ FGfdmSocket::FGfdmSocket(int port)
 
 FGfdmSocket::~FGfdmSocket()
 {
-  #ifndef macintosh
   if (sckt) shutdown(sckt,2);
   if (sckt_in) shutdown(sckt_in,2);
-  #endif
-
-  #ifdef __BORLANDC__
-    WSACleanup();
-  #endif
   Debug(1);
 }
 
@@ -229,13 +223,13 @@ string FGfdmSocket::Receive(void)
                     // class attribute and pass as a reference?
 
   if (sckt_in <= 0) {
-    #if defined(__BORLANDC__) || defined(_MSC_VER) || defined(__MINGW32__)
+    #if defined(_MSC_VER) || defined(__MINGW32__)
       sckt_in = accept(sckt, (struct sockaddr*)&scktName, &len);
     #else
       sckt_in = accept(sckt, (struct sockaddr*)&scktName, (socklen_t*)&len);
     #endif
     if (sckt_in > 0) {
-      #if defined(__BORLANDC__) || defined(_MSC_VER) || defined(__MINGW32__)
+      #if defined(_MSC_VER) || defined(__MINGW32__)
          ioctlsocket(sckt_in, FIONBIO,&NoBlock);
       #else
          ioctl(sckt_in, FIONBIO, &NoBlock);