X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AE779386F45A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1587455344; bh=gB6OQcWP63v0BpI7BXrFOuhFRdQRR47WjqYJleu0/Ew=; h=Date:Subject:To:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=tqhm1m4lYK2588/fB4OzRVEiUMVS83vLLwa7sOPx0ifdMZfJhORACZ0+SVZx/oLoR sebzfGgH6AF/Ff1dxazVtSxrh2cQ9BKzXXTTRgaVaxEGBeC9zWq9dxK4gEjxsO4q35 oV/375+v0RY0iCUYceRCF1R43lFoAU4DCfz96qFM= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 08B96384B0C1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=ENyUuAzn3+WITM3yV4Of7GwslmgV/9wNI7gNURXgqTw=; b=apQB9WXvK6nyh0goFYVY5jIy0tol3vdX+derSQnzD8rFpf7nwpd5osHvEnjwR4gaFj nXkCa2yb/o/uboTSefOK1BxYMGh1kqoT8c2tyOz66OE216MUXJCwMv/GVgV05r5mX9P4 NnyidY9iIoq2V5fRSStl6KGpjOtqGO93vqZcj12IPm/AlTov+BwEATuEt1kBdtzJVp+h 6OQO6r5b5pqZte1AP/CKWYE+u69h4AALS0BnRmuh+bqBzoeDc848H+m0YH2l4V/T+Yeo TggMFpy5+F6QN84gwafpDYrdkovGwigcMC5MpuiifYD7pxUPJNfDqDWaS5F9wMrXPNt9 bogg== X-Gm-Message-State: AGi0PuZzp7FtfQdL5OSai8o8Y3n2LmY1jtE07mEt60ogsM5pWxfVeXPS yEIHDuwSdXAaI5kCFxxBd+u/V2lFSdhH5VbVSVCEp3IYFNU= X-Google-Smtp-Source: APiQypLX2jQ0AVXYlnCbMShv/oy6CZwHqvtUHwxyBFY1DIZnVZDYMqpx8Bh0YmevKaX7NCryhrEV3Sex50jIVm4sOaU= X-Received: by 2002:ac2:4da7:: with SMTP id h7mr12818056lfe.95.1587455339374; Tue, 21 Apr 2020 00:48:59 -0700 (PDT) MIME-Version: 1.0 Date: Tue, 21 Apr 2020 03:48:45 -0400 Message-ID: Subject: nc fails to connect the first time and then succeeds To: cygwin AT cygwin DOT com X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.29 List-Id: General Cygwin discussions and problem reports List-Archive: List-Post: List-Help: List-Subscribe: , From: Jack Adrian Zappa via Cygwin Reply-To: Jack Adrian Zappa Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Cygwin" I was trying to do some testing of a ssh port forwarding issue I was having, by trying to reduce the problem into something simpler. So I reached for netcat (nc). Turns out that when trying to connect a listener to a sender directly, it will fail first and then succeed. Example: In terminal 1 we do: $ nc -l 1234 nc waits. In terminal 2 we do: $ nc -v localhost 1234 nc: connect to localhost port 1234 (tcp) failed: Connection refused Connection to localhost 1234 port [tcp/*] succeeded! The initial failure is fine when connecting directly, but this failure is disastrous when connecting through an ssh connection. This is because when the sshd connects to the nc listener, it will first fail and then succeed. However, that first failure makes the sshd think that there is no connection to be had and just closes the tunnel, making the nc sender just terminate. Is this a coding error or somehow by design? If by design, then why? If by error, then when can we expect this to be fixed? Thanks, Adrian -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple