[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Ayttm-commits] CVS: ayttm/src tcp_util.c,1.5,1.6
From: |
Edward L. Haletky <address@hidden> |
Subject: |
[Ayttm-commits] CVS: ayttm/src tcp_util.c,1.5,1.6 |
Date: |
Sun, 23 Mar 2003 17:28:10 -0500 |
Update of /cvsroot/ayttm/ayttm/src
In directory subversions:/tmp/cvs-serv5167/src
Modified Files:
tcp_util.c
Log Message:
Added MINGW32 defines and code for WIN32 port
Index: tcp_util.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/tcp_util.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- tcp_util.c 16 Mar 2003 21:29:37 -0000 1.5
+++ tcp_util.c 23 Mar 2003 22:28:08 -0000 1.6
@@ -29,11 +29,18 @@
*/
#include <string.h>
+#ifndef __MINGW32__
#include <netdb.h>
+#endif
#include <sys/types.h>
+#ifdef __MINGW32__
+#include <winsock2.h>
+#include <limits.h>
+#else
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
+#endif
#include <unistd.h>
#include <stdlib.h>
#include <fcntl.h>
@@ -274,7 +281,7 @@
static struct hostent *server;
int servfd;
struct connect_callback_data * ccd;
- int error;
+ int error,err;
if(tag_pool >= INT_MAX)
return -1;
@@ -291,7 +298,9 @@
return -1;
}
+#ifndef __MINGW32__
fcntl(servfd, F_SETFL, O_NONBLOCK);
+#endif
eb_debug(DBG_CORE, "connecting to %s:%d\n", host, port);
@@ -301,11 +310,17 @@
serv_addr.sin_port = htons(port);
error = connect(servfd, (struct sockaddr *) &serv_addr,
sizeof(serv_addr));
+#ifdef __MINGW32__
+ err = WSAGetLastError();
+#define EINPROGRESS WSAEINPROGRESS
+#else
+ err = errno;
+#endif
if(!error) {
callback(servfd, 0, callback_data);
return 0;
- } else if(error == -1 && errno == EINPROGRESS) {
+ } else if(error == -1 && err == EINPROGRESS) {
ccd = calloc(1, sizeof(struct connect_callback_data));
ccd->callback = callback;
ccd->callback_data = callback_data;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Ayttm-commits] CVS: ayttm/src tcp_util.c,1.5,1.6,
Edward L. Haletky <address@hidden> <=
- Prev by Date:
[Ayttm-commits] CVS: ayttm ChangeLog,1.392,1.393 configure.in,1.387,1.388
- Next by Date:
[Ayttm-commits] CVS: ayttm/src image_window.c,1.1,1.2
- Previous by thread:
[Ayttm-commits] CVS: ayttm ChangeLog,1.392,1.393 configure.in,1.387,1.388
- Next by thread:
[Ayttm-commits] CVS: ayttm/src image_window.c,1.1,1.2
- Index(es):