From: nishi Date: Tue, 6 Feb 2024 01:43:50 +0000 (+0000) Subject: winsock is great X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=89643047ebab0ae3c02f90d349eaf56b79df297d;p=libw3.git winsock is great git-svn-id: file:///raid/svn-main/nishi-libw3/trunk@170 d27a3e52-49c5-7645-884c-6793ebffc270 --- diff --git a/Library/DNS.c b/Library/DNS.c index 2371344..bcaadb7 100644 --- a/Library/DNS.c +++ b/Library/DNS.c @@ -61,8 +61,10 @@ int __W3_DNS_Connect(const char* hostname, bool ssl, uint16_t port for(rp = result; rp != NULL; rp = rp->ai_next) { sock = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol); if(sock == -1) continue; - int nzero = 0; - setsockopt(sock, SOL_SOCKET, SO_SNDBUF, (char*)&nzero, sizeof(nzero)); + int nbyt = 65535; + setsockopt(sock, SOL_SOCKET, SO_RCVBUF, (char*)&nbyt, sizeof(nbyt)); + nbyt = 65535; + setsockopt(sock, SOL_SOCKET, SO_SNDBUF, (char*)&nbyt, sizeof(nbyt)); int yes = 1; setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (char*)&yes, sizeof(yes)); if(connect(sock, rp->ai_addr, rp->ai_addrlen) != -1) break; diff --git a/Library/Util.c b/Library/Util.c index 9484c57..c1f7c28 100644 --- a/Library/Util.c +++ b/Library/Util.c @@ -59,29 +59,11 @@ 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 { -#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 + return send(w3->sock, data, length, 0); } -#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 df48299..a9d56ea 100644 --- a/W3Version.h.p +++ b/W3Version.h.p @@ -6,7 +6,7 @@ extern "C" { #endif -#define LIBW3_VERSION "2.2O" \ +#define LIBW3_VERSION "2.2P" \ SUFFIX #ifdef __cplusplus