From: nishi Date: Tue, 6 Feb 2024 01:34:56 +0000 (+0000) Subject: WSASend X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=db2cbc25c94efc52f766398e71e51b4ccec50197;p=libw3.git WSASend git-svn-id: file:///raid/svn-main/nishi-libw3/trunk@169 d27a3e52-49c5-7645-884c-6793ebffc270 --- diff --git a/Library/Util.c b/Library/Util.c index 9c461a4..9484c57 100644 --- a/Library/Util.c +++ b/Library/Util.c @@ -10,7 +10,7 @@ #ifdef __MINGW32__ #include -#include +#include #else #include #include @@ -59,11 +59,29 @@ unsigned long __W3_Auto_Write(struct W3* w3, char* data, unsigned long length) { if(w3->ssl != NULL) { return SSL_write(w3->ssl, data, length); } else { - return send(w3->sock, data, length, 0); +#ifdef __MINGW32__ + int sent_bytes; + WSABUF buf; + buf.len = length; + buf.buf = data; + int r = WSASend(w3->sock, &buf, 1, &sent_bytes, 0, NULL, NULL); + return r == SOCKET_ERROR ? -1 : sent_bytes; +#else + return send(w3->sock, data, length, 0)+ +#endif } +#else +#ifdef __MINGW32__ + int sent_bytes; + WSABUF buf; + buf.len = length; + buf.buf = data; + int r = WSASend(w3->sock, &buf, 1, &sent_bytes, 0, NULL, NULL); + return r == SOCKET_ERROR ? -1 : sent_bytes; #else return send(w3->sock, data, length, 0); #endif +#endif } unsigned long __W3_Auto_Read(struct W3* w3, char* data, unsigned long length) { diff --git a/W3Version.h.p b/W3Version.h.p index f852b65..df48299 100644 --- a/W3Version.h.p +++ b/W3Version.h.p @@ -6,7 +6,7 @@ extern "C" { #endif -#define LIBW3_VERSION "2.2N" \ +#define LIBW3_VERSION "2.2O" \ SUFFIX #ifdef __cplusplus