git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56940
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
#include <stdlib.h>
#endif
#include <stdlib.h>
#endif
+#include <time.h> // for timeval
+
enum GAddressType
{
GSOCK_NOFAMILY = 0,
enum GAddressType
{
GSOCK_NOFAMILY = 0,
bool m_broadcast;
bool m_dobind;
bool m_broadcast;
bool m_dobind;
struct timeval m_timeout;
struct timeval m_timeout;
-#else
- unsigned long m_timeout;
-#endif
GSocketEventFlags m_detected;
GSocketEventFlags m_detected;
*/
void GSocketBase::SetTimeout(unsigned long millis)
{
*/
void GSocketBase::SetTimeout(unsigned long millis)
{
m_timeout.tv_sec = (millis / 1000);
m_timeout.tv_usec = (millis % 1000) * 1000;
m_timeout.tv_sec = (millis / 1000);
m_timeout.tv_usec = (millis % 1000) * 1000;
-#else
- m_timeout = millis;
-#endif
}
void GSocketBase::NotifyOnStateChange(GSocketEvent event)
}
void GSocketBase::NotifyOnStateChange(GSocketEvent event)
*/
GSocketError GSocket::Input_Timeout()
{
*/
GSocketError GSocket::Input_Timeout()
{
- /* Linux select() will overwrite the struct on return */
- tv.tv_sec = (m_timeout / 1000);
- tv.tv_usec = (m_timeout % 1000) * 1000;
+ // Linux select() will overwrite the struct on return so make a copy
+ struct timeval tv = m_timeout;
*/
GSocketError GSocket::Output_Timeout()
{
*/
GSocketError GSocket::Output_Timeout()
{
fd_set writefds;
int ret;
fd_set writefds;
int ret;
- /* Linux select() will overwrite the struct on return */
- tv.tv_sec = (m_timeout / 1000);
- tv.tv_usec = (m_timeout % 1000) * 1000;
+ // Linux select() will overwrite the struct on return so make a copy
+ struct timeval tv = m_timeout;
GSocket_Debug( ("m_non_blocking has: %d\n", (int)m_non_blocking) );
GSocket_Debug( ("m_non_blocking has: %d\n", (int)m_non_blocking) );