]> Nishi Git Mirror - libw3.git/commitdiff
winsock is great
authornishi <nishi@d27a3e52-49c5-7645-884c-6793ebffc270>
Tue, 6 Feb 2024 01:43:50 +0000 (01:43 +0000)
committernishi <nishi@d27a3e52-49c5-7645-884c-6793ebffc270>
Tue, 6 Feb 2024 01:43:50 +0000 (01:43 +0000)
git-svn-id: file:///raid/svn-main/nishi-libw3/trunk@170 d27a3e52-49c5-7645-884c-6793ebffc270

Library/DNS.c
Library/Util.c
W3Version.h.p

index 2371344a14b2854508ce3019ab6301bcbf3a575c..bcaadb7739b82a75f467e9a27df0f3ff71f8e7fe 100644 (file)
@@ -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;
index 9484c57c07ec365e3dba67b86b9c977ef1042003..c1f7c28729ef8968699a373b378ad2c94d8e3abd 100644 (file)
@@ -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) {
index df48299ff16c94900f9f28b4cf36c840c9af8f37..a9d56ea866eef5462f9081a70c64da0c4826d551 100644 (file)
@@ -6,7 +6,7 @@
 extern "C" {
 #endif
 
-#define LIBW3_VERSION "2.2O" \
+#define LIBW3_VERSION "2.2P" \
 SUFFIX
 
 #ifdef __cplusplus