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;
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) {