- return the correct errno value instead of using -1
#endif
}
+int Socket::errorNumber()
+{
+#if defined(WINSOCK)
+ return WSAGetLastError();
+#else
+ return errno;
+#endif
+}
+
//////////////////////////////////////////////////////////////////////
//
void setBroadcast ( bool broadcast ) ;
static bool isNonBlockingError () ;
-
+ static int errorNumber();
+
static int select ( Socket** reads, Socket** writes, int timeout ) ;
} ;
write_blocked = true ;
return 0;
} else {
- this->handleError (result);
+ this->handleError (errorNumber());
close();
return -1;
}
} else if (isNonBlockingError ()) {
return 0;
} else {
- this->handleError (result);
+ this->handleError (errorNumber());
close();
return -1;
}
return 0;
} else {
// some other error condition
- handleError (result);
+ handleError (errorNumber());
close();
return -1;
}