diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2010-09-15 18:25:18 +1000 |
---|---|---|
committer | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2010-09-20 17:51:17 +1000 |
commit | 7483649514ed2049deaf59077dbb77c915ba22a0 (patch) | |
tree | 5d8225fb2ce2663ee4c4e81edf2c43f2e4f80594 | |
parent | 52748f68338010d28979c653ad17ca1f14d3df1a (diff) | |
download | busybox-w32-7483649514ed2049deaf59077dbb77c915ba22a0.tar.gz busybox-w32-7483649514ed2049deaf59077dbb77c915ba22a0.tar.bz2 busybox-w32-7483649514ed2049deaf59077dbb77c915ba22a0.zip |
win32: reimplement connect()
connect() now returns a socket handle, i.e. a HANDLE. This kind of
handle works with read()/write(). But on the other hand, FILE*
functions are dead because they are not crt file handles??
-rw-r--r-- | include/mingw.h | 2 | ||||
-rw-r--r-- | win32/net.c | 7 |
2 files changed, 9 insertions, 0 deletions
diff --git a/include/mingw.h b/include/mingw.h index b2d73ce1b..1caf65464 100644 --- a/include/mingw.h +++ b/include/mingw.h | |||
@@ -176,8 +176,10 @@ NOIMPL(ioctl,int fd UNUSED_PARAM, int code UNUSED_PARAM,...); | |||
176 | 176 | ||
177 | #ifdef CONFIG_WIN32_NET | 177 | #ifdef CONFIG_WIN32_NET |
178 | int mingw_socket(int domain, int type, int protocol); | 178 | int mingw_socket(int domain, int type, int protocol); |
179 | int mingw_connect(int sockfd, struct sockaddr *sa, size_t sz); | ||
179 | 180 | ||
180 | # define socket mingw_socket | 181 | # define socket mingw_socket |
182 | # define connect mingw_connect | ||
181 | #endif | 183 | #endif |
182 | NOIMPL(mingw_sendto,SOCKET s UNUSED_PARAM, const char *buf UNUSED_PARAM, int len UNUSED_PARAM, int flags UNUSED_PARAM, const struct sockaddr *sa UNUSED_PARAM, int salen UNUSED_PARAM); | 184 | NOIMPL(mingw_sendto,SOCKET s UNUSED_PARAM, const char *buf UNUSED_PARAM, int len UNUSED_PARAM, int flags UNUSED_PARAM, const struct sockaddr *sa UNUSED_PARAM, int salen UNUSED_PARAM); |
183 | NOIMPL(mingw_listen,SOCKET s UNUSED_PARAM,int backlog UNUSED_PARAM); | 185 | NOIMPL(mingw_listen,SOCKET s UNUSED_PARAM,int backlog UNUSED_PARAM); |
diff --git a/win32/net.c b/win32/net.c index 98204b99c..eadda6b69 100644 --- a/win32/net.c +++ b/win32/net.c | |||
@@ -45,3 +45,10 @@ int mingw_socket(int domain, int type, int protocol) | |||
45 | } | 45 | } |
46 | return sockfd; | 46 | return sockfd; |
47 | } | 47 | } |
48 | |||
49 | #undef connect | ||
50 | int mingw_connect(int sockfd, struct sockaddr *sa, size_t sz) | ||
51 | { | ||
52 | SOCKET s = (SOCKET)_get_osfhandle(sockfd); | ||
53 | return connect(s, sa, sz); | ||
54 | } | ||