]> git.mxchange.org Git - simgear.git/blobdiff - simgear/io/sg_socket.hxx
plib/net based udp client/server sockets.
[simgear.git] / simgear / io / sg_socket.hxx
index be8171351a3fe3b5a4632d069abbbf38d62b4361..9003c086c92a9897729b6abbde15c390cd814ace 100644 (file)
@@ -41,7 +41,7 @@
 
 SG_USING_STD(string);
 
-#if defined(_MSC_VER)
+#if defined(_MSC_VER) || defined(__MINGW32__)
 #  include <winsock.h>
 #endif
 
@@ -53,7 +53,7 @@ SG_USING_STD(string);
  */
 class SGSocket : public SGIOChannel {
 public:
-#if defined(_MSC_VER)
+#if defined(_MSC_VER) || defined(__MINGW32__)
     typedef SOCKET SocketType;
 #else
     typedef int SocketType;
@@ -83,11 +83,11 @@ private:
     // wrapper functions
     size_t readsocket( int fd, void *buf, size_t count );
     size_t writesocket( int fd, const void *buf, size_t count );
-#if !defined(_MSC_VER)
+#if !defined(_MSC_VER) && !defined(__MINGW32__)
     int closesocket(int fd);
 #endif
 
-#if defined(_MSC_VER)
+#if defined(_MSC_VER) || defined(__MINGW32__)
     // Ensure winsock has been initialised.
     static bool wsock_init;
     static bool wsastartup();
@@ -167,13 +167,16 @@ public:
     // close file
     bool close();
 
-    /** Enable non-blocking mode. */
+    /**
+     * Enable non-blocking mode.
+     * @return success/failure
+     */
     bool nonblock();
 
-    /** Return the remote host name */
+    /** @return the remote host name */
     inline string get_hostname() const { return hostname; }
 
-    /** Return the port number (in string form) */
+    /** @return the port number (in string form) */
     inline string get_port_str() const { return port_str; }
 };