delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2019/07/30/17:31:44

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:from:reply-to:to:subject:date:message-id
:content-type:content-transfer-encoding:mime-version; q=dns; s=
default; b=bzfE5KQlPa1tc30psn3uGj0I5ySJSJ5DULig5knn+Qq2XMvoUnjQ7
ttjpNhgEJjiCY6u3x89AM4rwSN5x/9GkyCw+5Py6DsRYDuG+ygMGbDl1C80Rjb0H
zWWDZpHwet4ETQJL8wFews1G17YKPtb9kDiJ/HNme+djAyrXoMDV04=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:from:reply-to:to:subject:date:message-id
:content-type:content-transfer-encoding:mime-version; s=default;
bh=F4dFZTzyNdHSrwW0qtErvPdJLQU=; b=FRidF1zpqKJzTic8fXDbVgFjt6rf
iv+xJPihlft4Ow3vSy5hZRrsXgNs9sd7HUANSiMEO0n/Q2SMqVfj28pv+0zZZvwr
s4RcjkUScwYZwP0wKziaMi6HsK7qmKwDeScKq6ArkprgmEXYh9PCQkE0f3Ecsfhd
xTbN3+HX59rKS84=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=UD:sa, a.exe, UD:a.exe, aexe
X-HELO: nihcesxwayst04.hub.nih.gov
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nih.gov; i=@nih.gov; q=dns/txt; s=NIH; t=1564522244; x=1596058244; h=from:to:subject:date:message-id: content-transfer-encoding:mime-version; bh=w18N8wq0N2Mj+jwXpts9kz18KTE16Lvq1d4P0s05cbs=; b=MA2tC1JccBos2CymmjAeA7YoLNql2TNBhePBWrYR7qXIw3HcbZWOXYKT IbxcBxRsthZVGJntapotlVHP8u1ZWVoEjLK+tvKMLkILIfEnhJlP2nZlz 5zK6h4VgtiHVQBc9iLEDr75iK8NclLpq62q3giDVD+3TJSkTfNzh8YNm0 5ZFgsayfEfDIbMSG2WlQ2NcyrwhAMkCCY5AuI+RrnAxD/jMN7NzXd+8Gx ezQuoDml86BqQxjSdF1SKR3metV/kikra87aHqjYH8n+CHLuXeMgynwLT PUBU/lrX8LLeZ/i6I582htpndNQJNHT+e5BQZOQNr9tZ/lLEeWrEU0Kom w==;
IronPort-SDR: pZwrCxP5F4rE0qZW2UeqG+yXm9SWPAbf0Ob4WnWbKQHzu6K6dBdtluO5yz0GvDuqYeSblob8Ez R4Z0yUI1Vohw==
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hCiJDtvXniuTgLy/FLtjJEEm+bvnIMGzMRsQnVlzWeeEua+zIDHnB3d2ZycEJNc+HaNB5pX8ZDPQ7iDdNEJg+asRzFXnUjXnf8d4GRRwOFwM8bK3Vc/EFZqGVxzsOIovwvV6bppof9Be2ivxxhpYgOQeowNEnHhNbpkZprCmnGRX34rOoZBzJGhxg3MH7U7fc3rWo6DPBlfi1nCFgU7XPUP69oqmHq2t88VljeEc7QLsOs0Gr6A7zhlPhT+kDA0pIhmAuAhKQHDoUmw4T67nUqwKxly7iczmpTZ8n3R/rxcx3QQ7d5PC/rugswKiFMOndM6KdsmsmJOfiO6R89LVCQ==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=w18N8wq0N2Mj+jwXpts9kz18KTE16Lvq1d4P0s05cbs=; b=jx2r7Nb8RkjmLV04ZSeRdaY+4+IKkKKAAw7PfmjWqX1x6YCHj8dj/M3pmCdJrmZ1Zvv8j7tvBu9IlEMBrSPmXsfRAL5ch+9LQbKWZy5s29jCy+0eFqYVxBXVpFdkt/KalxCtqQlytzZE8YdF/4gRUy9Ze79pFQU5HTKdiz5QqLgRHImWQuPSDZvWq8rM5PAwgBsJzqflIDieAWaArGN0VzIE4zIHBMKAIhr/CSxJysJGERvGRj3f1RP1fIYjAswhyovfskmIHkeUMzy0jerNVhvl67UGVwnLsk5TCBle+7k2YG5fcpK/5g0u6QOzVT6CM2CoyDy4nZFYPkWjC3z/NA==
ARC-Authentication-Results: i=1; mx.microsoft.com 1;spf=pass smtp.mailfrom=ncbi.nlm.nih.gov;dmarc=pass action=none header.from=ncbi.nlm.nih.gov;dkim=pass header.d=ncbi.nlm.nih.gov;arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nih.onmicrosoft.com; s=selector1-nih-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=w18N8wq0N2Mj+jwXpts9kz18KTE16Lvq1d4P0s05cbs=; b=neg4FzEhlPJQGav7Z2R7rJ0QKtXWrIKghaS3FS5eWQkD1va1QEvDVlQaWrstWmFFNCIAxu1oNX9CZf3MlNhXUlVkIesRva/fhBqQ0DbQ0B2nLr0B/391NhdqdQYQ55Ktd6sQsA8C+RZJgLWg9qL7GUIKMwp7tCv37bY569PTv1E=
From: "Lavrentiev, Anton (NIH/NLM/NCBI) [C] via cygwin" <cygwin AT cygwin DOT com>
Reply-To: "Lavrentiev, Anton (NIH/NLM/NCBI) [C]" <lavr AT ncbi DOT nlm DOT nih DOT gov>
To: "'cygwin AT cygwin DOT com'" <cygwin AT cygwin DOT com>
Subject: TCP_CORK (aka TCP_NOPUSH) does not work
Date: Tue, 30 Jul 2019 21:30:41 +0000
Message-ID: <BL0PR0901MB43089F348C3D31D7E07EBC20A5DC0@BL0PR0901MB4308.namprd09.prod.outlook.com>
authentication-results: spf=none (sender IP is ) smtp.mailfrom=lavr AT ncbi DOT nlm DOT nih DOT gov;
x-ms-oob-tlc-oobclassifiers: OLM:7219;
x-ms-exchange-senderadcheck: 1
MIME-Version: 1.0
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: lavr AT nih DOT gov
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id x6ULVS3n020700

Hi,

Consider the following code:

$ cat cork.c
#include <arpa/inet.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/types.h>

#if defined(TCP_NOPUSH)  &&  !defined(TCP_CORK)
#  define TCP_CORK  TCP_NOPUSH
#endif


int main(int argc, const char* argv[])
{
    union {
        struct sockaddr_in in;
        struct sockaddr    sa;
    } addr;
    int sock, cork = 1;

    memset(&addr, 0, sizeof(addr));
    if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0)
        perror("socket");
    addr.in.sin_family = AF_INET;
    addr.in.sin_addr.s_addr = inet_addr(argv[1]);
    addr.in.sin_port = htons((unsigned short) atoi(argv[2]));
    if (connect(sock, &addr.sa, sizeof(addr.in)) < 0)
        perror("connect");
    if (setsockopt(sock, IPPROTO_TCP, TCP_CORK, (char*) &cork, sizeof(cork)) != 0)
        perror("cork");
    return 0;
}

When compiled and run under Cygwin, the last syscall, setsockopt(), returns an error, Protocol not available:

gcc cork.c
./a.exe 8.8.8.8 443
cork: Protocol not available

The same code works under Linux just fine.  I straced both.

gcc cork.c
./a.out 8.8.8.8 443

Any ideas?  Is TCP_NOPUSH (which is a BSDism, BTW) not actually usable on Cygwin?  If not, why is it in the header file <netinet/tcp.h>?

TIA!


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019