- if (m_fd == INVALID_SOCKET)
- return (wxSOCKET_LOST_FLAG & flags);
-
- struct timeval tv;
- if ( timeout )
- tv = *timeout;
- else
- tv.tv_sec = tv.tv_usec = 0;
-
- fd_set readfds;
- fd_set writefds;
- fd_set exceptfds;
- wxFD_ZERO(&readfds);
- wxFD_ZERO(&writefds);
- wxFD_ZERO(&exceptfds);
- wxFD_SET(m_fd, &readfds);
- if (flags & wxSOCKET_OUTPUT_FLAG || flags & wxSOCKET_CONNECTION_FLAG)
- wxFD_SET(m_fd, &writefds);
- wxFD_SET(m_fd, &exceptfds);
-
- /* Check 'sticky' CONNECTION flag first */
- result |= wxSOCKET_CONNECTION_FLAG & m_detected;
-
- /* If we have already detected a LOST event, then don't try
- * to do any further processing.
- */
- if ((m_detected & wxSOCKET_LOST_FLAG) != 0)
- {
- m_establishing = false;
- return (wxSOCKET_LOST_FLAG & flags);
- }