--- aseqnet.c.bak 2012-01-25 10:43:38.000000000 +0100 +++ aseqnet.c 2014-10-27 21:33:45.000000000 +0100 @@ -3,6 +3,8 @@ * ver.0.1 * * Copyright (C) 1999-2000 Takashi Iwai + * Modified by Rob van der Putten, Leiden, Holland, + * rob at sput dot nl. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -22,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -330,6 +333,9 @@ int i; int curstate = 1; struct sockaddr_in addr; + /* RvdP, nagle and quickack */ + int nodelay = 1; + int quickack = 1; memset(&addr, 0, sizeof(addr)); @@ -345,6 +351,14 @@ setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &curstate, sizeof(curstate)); /* the return value is ignored.. */ + /* RvdP, nagle and quickack */ + if ((setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY, &nodelay, sizeof(nodelay))) < 0) { + perror("Error setsockopt tcp_nodelay"); + } + if ((setsockopt(sockfd, IPPROTO_TCP, TCP_QUICKACK, &quickack, sizeof(quickack))) < 0) { + perror("Error setsockopt tcp_quickack"); + } + if (bind(sockfd, (struct sockaddr *)&addr, sizeof(addr)) < 0) { perror("can't bind"); exit(1); @@ -397,6 +411,8 @@ struct sockaddr_in addr; struct hostent *host; int curstate = 1; + int nodelay = 1; + int quickack = 1; int fd; if ((fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0){ @@ -407,6 +423,15 @@ perror("setsockopt"); exit(1); } + + /* RvdP, nagle and quickack */ + if ((setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &nodelay, sizeof(nodelay))) < 0) { + perror("Error setsockopt tcp_nodelay"); + } + if ((setsockopt(fd, IPPROTO_TCP, TCP_QUICKACK, &quickack, sizeof(quickack))) < 0) { + perror("Error setsockopt tcp_quickack"); + } + if ((host = gethostbyname(server)) == NULL){ fprintf(stderr, _("can't get address %s\n"), server); exit(1);