#include <ctype.h>
#include <winsock.h>
+/* if we use configure for MSW SOCKLEN_T will be already defined */
+#ifndef SOCKLEN_T
#define SOCKLEN_T int
+#endif
+
#define CLASSNAME "_GSocket_Internal_Window_Class"
#define WINDOWNAME "_GSocket_Internal_Window_Name"
{
assert(socket != NULL);
- return (flags & socket->m_detected);
+ return flags & socket->m_detected;
}
/* Attributes */
fd_set writefds;
fd_set exceptfds;
- if (!socket->m_non_blocking)
+ FD_ZERO(&writefds);
+ FD_ZERO(&exceptfds);
+ FD_SET(socket->m_fd, &writefds);
+ FD_SET(socket->m_fd, &exceptfds);
+ if (select(0, NULL, &writefds, &exceptfds, &socket->m_timeout) == 0)
{
- FD_ZERO(&writefds);
- FD_ZERO(&exceptfds);
- FD_SET(socket->m_fd, &writefds);
- FD_SET(socket->m_fd, &exceptfds);
- if (select(0, NULL, &writefds, &exceptfds, &socket->m_timeout) == 0)
- {
- socket->m_error = GSOCK_TIMEDOUT;
- return GSOCK_TIMEDOUT;
- }
+ socket->m_error = GSOCK_TIMEDOUT;
+ return GSOCK_TIMEDOUT;
}
if (!FD_ISSET(socket->m_fd, &writefds))
{