aboutsummaryrefslogtreecommitdiff
path: root/lib/connect.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/connect.c')
-rw-r--r--lib/connect.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/connect.c b/lib/connect.c
index c1206cee5..7727bf017 100644
--- a/lib/connect.c
+++ b/lib/connect.c
@@ -704,6 +704,27 @@ static void nosigpipe(struct connectdata *conn,
#define nosigpipe(x,y)
#endif
+#ifdef WIN32
+/* When you run a program that uses the Windows Sockets API, you may
+ experience slow performance when you copy data to a TCP server.
+
+ http://support.microsoft.com/kb/823764
+
+ Work-around: Make the Socket Send Buffer Size Larger Than the Program Send
+ Buffer Size
+
+*/
+static void sndbufset(struct connectdata *conn,
+ curl_socket_t sockfd)
+{
+ int val = CURL_MAX_WRITE_SIZE + 32;
+ setsockopt(sockfd, SOL_SOCKET, SO_SNDBUF, (const char *)&val, sizeof(val));
+}
+#else
+#define sndbufset(x,y)
+#endif
+
+
/* singleipconnect() connects to the given IP only, and it may return without
having connected if used from the multi interface. */
static curl_socket_t
@@ -807,6 +828,8 @@ singleipconnect(struct connectdata *conn,
nosigpipe(conn, sockfd);
+ sndbufset(conn, sockfd);
+
if(data->set.fsockopt) {
/* activate callback for setting socket options */
error = data->set.fsockopt(data->set.sockopt_client,