SG_USING_STD(string);
-#if defined(_MSC_VER)
+#if defined(_MSC_VER) || defined(__MINGW32__)
# include <winsock.h>
#endif
*/
class SGSocket : public SGIOChannel {
public:
-#if defined(_MSC_VER)
+#if defined(_MSC_VER) || defined(__MINGW32__)
typedef SOCKET SocketType;
#else
typedef int SocketType;
// 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();
// 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; }
};