Ecore_Con_Server_Data *svr = eo_data_scope_get(obj, ECORE_CON_SERVER_CLASS);
struct linger lin;
const char *memerr = NULL;
+#ifdef _WIN32
+ u_long mode = 1;
+#endif
errno = 0;
if (!net_info) /* error message has already been handled */
svr->fd = socket(net_info->info.ai_family, net_info->info.ai_socktype,
net_info->info.ai_protocol);
if (svr->fd < 0) goto error;
+
+#ifdef _WIN32
+ if (ioctlsocket(svr->fd, FIONBIO, &mode)) goto error;
+#else
if (fcntl(svr->fd, F_SETFL, O_NONBLOCK) < 0) goto error;
if (fcntl(svr->fd, F_SETFD, FD_CLOEXEC) < 0) goto error;
+#endif
lin.l_onoff = 1;
lin.l_linger = 0;
#endif
const int on = 1;
const char *memerr = NULL;
+#ifdef _WIN32
+ u_long mode = 1;
+#endif
type = svr->type;
type &= ECORE_CON_TYPE;
if (setsockopt(svr->fd, SOL_SOCKET, SO_REUSEADDR, (const void *)&on, sizeof(on)) != 0)
goto error;
+
+#ifdef _WIN32
+ if (ioctlsocket(svr->fd, FIONBIO, &mode)) goto error;
+#else
if (fcntl(svr->fd, F_SETFL, O_NONBLOCK) < 0) goto error;
if (fcntl(svr->fd, F_SETFD, FD_CLOEXEC) < 0) goto error;
+#endif
if (bind(svr->fd, net_info->info.ai_addr, net_info->info.ai_addrlen) < 0)
goto error;
int res;
int curstate = 0;
const char *memerr = NULL;
+#ifdef _WIN32
+ u_long mode = 1;
+#endif
errno = 0;
if (!net_info) /* error message has already been handled */
net_info->info.ai_protocol);
if (svr->fd < 0) goto error;
+#ifdef _WIN32
+ if (ioctlsocket(svr->fd, FIONBIO, &mode)) goto error;
+#else
if (fcntl(svr->fd, F_SETFL, O_NONBLOCK) < 0) goto error;
if (fcntl(svr->fd, F_SETFD, FD_CLOEXEC) < 0) goto error;
+#endif
if (setsockopt(svr->fd, SOL_SOCKET, SO_REUSEADDR, (const void *)&curstate, sizeof(curstate)) < 0)
goto error;
#ifdef _WIN32
if (res == SOCKET_ERROR)
{
- if (WSAGetLastError() != WSAEINPROGRESS)
+ if (WSAGetLastError() != WSAEWOULDBLOCK)
{
char *err;
err = evil_format_message(WSAGetLastError());
int broadcast = 1;
const char *memerr = NULL;
Ecore_Con_Server_Data *svr = eo_data_scope_get(obj, ECORE_CON_SERVER_CLASS);
+#ifdef _WIN32
+ u_long mode = 1;
+#endif
errno = 0;
if (!net_info) /* error message has already been handled */
svr->fd = socket(net_info->info.ai_family, net_info->info.ai_socktype,
net_info->info.ai_protocol);
if (svr->fd < 0) goto error;
+
+#ifdef _WIN32
+ if (ioctlsocket(svr->fd, FIONBIO, &mode)) goto error;
+#else
if (fcntl(svr->fd, F_SETFL, O_NONBLOCK) < 0) goto error;
if (fcntl(svr->fd, F_SETFD, FD_CLOEXEC) < 0) goto error;
+#endif
if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_REMOTE_BROADCAST)
{
if (setsockopt(svr->fd, SOL_SOCKET, SO_BROADCAST,
unsigned int client_addr_len;
const char *clerr = NULL;
Ecore_Con_Server_Data *svr = eo_data_scope_get(svr_obj, ECORE_CON_SERVER_CLASS);
+#ifdef _WIN32
+ u_long mode = 1;
+#endif
if (svr->delete_me)
return ECORE_CALLBACK_RENEW;
goto error;
}
+#ifdef _WIN32
+ if (ioctlsocket(cl->fd, FIONBIO, &mode)) goto error;
+#else
if (fcntl(cl->fd, F_SETFL, O_NONBLOCK) < 0) goto error;
if (fcntl(cl->fd, F_SETFD, FD_CLOEXEC) < 0) goto error;
+#endif
cl->fd_handler = ecore_main_fd_handler_add(cl->fd, ECORE_FD_READ,
_ecore_con_svr_cl_handler, obj, NULL, NULL);
if (!cl->fd_handler) goto error;
int num;
Ecore_Con_Server *svr_obj = data;
Ecore_Con_Client *obj = NULL;
++#ifdef _WIN32
++ u_long mode = 1;
++#endif
Ecore_Con_Server_Data *svr = eo_data_scope_get(svr_obj, ECORE_CON_SERVER_CLASS);
if (svr->delete_me)
return ECORE_CALLBACK_RENEW;
#ifdef _WIN32
- num = fcntl(svr->fd, F_SETFL, O_NONBLOCK);
- if (num >= 0)
+ if (!ioctlsocket(svr->fd, FIONBIO, &mode))
num = recvfrom(svr->fd, (char *)buf, sizeof(buf), 0,
(struct sockaddr *)&client_addr,
&client_addr_len);