delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2020/04/21/12:31:11

X-Recipient: archive-cygwin AT delorie DOT com
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 0062F384B0C1
Authentication-Results: sourceware.org;
dmarc=none (p=none dis=none) header.from=towo.net
Authentication-Results: sourceware.org; spf=none smtp.mailfrom=towo AT towo DOT net
Subject: Re: nc fails to connect the first time and then succeeds
To: cygwin AT cygwin DOT com
References: <CAKepmaicf+zJDzgdTBQCHbjNqGXbm2yLWkrsxe6XYTucBk3FPg AT mail DOT gmail DOT com>
<CAKepmajsRwzkmqzjJsZqkk_eJSkSarTiJ8QGuxFzDAeWNG+3bw AT mail DOT gmail DOT com>
From: Thomas Wolff <towo AT towo DOT net>
X-Tagtoolbar-Keys: D20200421183018709
Message-ID: <502440b5-0c10-ab66-930b-dbb2304d9550@towo.net>
Date: Tue, 21 Apr 2020 18:30:18 +0200
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101
Thunderbird/68.7.0
MIME-Version: 1.0
In-Reply-To: <CAKepmajsRwzkmqzjJsZqkk_eJSkSarTiJ8QGuxFzDAeWNG+3bw@mail.gmail.com>
X-Provags-ID: V03:K1:zxP73fJp2wDzkbt0/ZY9J/OKSP3mWZxyY8U/q2oSkiaJzO0ZqeP
WeuhJ448RoJ0KMt99ItWfpvdPc/HyajASHT6A/EDsImMnxgzDmkfEorKTrhrmTW7wYO3kwo
vLGpIZRAG8fSbwhJBx/u0/1BtKJjR4/E1kRPiYuXMoU5iQTOsIpvqU3NdMbobWoe7OAf6h4
2uEE9rVxm8d//GXuP5tqw==
X-UI-Out-Filterresults: notjunk:1;V03:K0:CZ0SX61GL4Q=:n6ANYU1YuOMnYQ5LSdOXdH
zgiesub+c8ONN+15IDeD9d8lTGPLg6z43rZYDZEsY5shvHiSsB2u04z8UAHS+nINLwYNxnaHx
vQIp3gMZ9QaumF2cf/+ZvCn6Fmwsa3ExVGvT1CrMWuQ2qiNsDmUWvGF3mh4gj/SZKjFsBX0C8
Amcwi7lVLoBj1lv2ELAAF+y8zMw6DoILFh2dK9cr8SqXR7Rgd4F8A0+4ZvCj9X9TIaKBsKy6T
tY7JRbfTSIv8RnJeQg38HxOwibWVFUZ8OZRu5L3/RvsXmHsa66StlD6XSi+tGVmQebvau6QNM
iaTs95djWp0HIa4AwPBq/7KUAO38rBp/mAVgd+KwGw+5hkwnmBpGcv3WiPhPIliC6YZ+cTJ1Z
9zSwq6XZL0l85OvSuqwvOdibAmrJwnBlh0oFZthQk5pZwsJmZaY8IkXl+I0mihJzAL/uH72mE
murZ8hD0DNMnwYBdkE512do9pmPEQtJcuEMiG7Lljv6YBiLSLbvfiiQkhYFtdDmZMTYQhb+QQ
vcSXh8C3Ggo3sYZOczrnJqR9zu/W7bIZ2tiqbnOV2Rkw73dbk1m+V7OhhWcsojoa8+FVIJwXh
axL8goNVtiH/mpwGG9Hg1ELC23OyUs91ilaIaEIQJxQMVsuyXZRugZq6vqSr3wu3q5Jc6rPRs
2P5L9F+0B3FGLAFFTko9H4dcGvXDObDSvviO2nmR/fc4DUkQHaFyA+KF2q2borrUf1K57bbex
I8iy0n33XyhWy2zaklPjn7mNoFT8VBGOrkx95G8sE3TeuRoOijV/Xv8RdrsDDDbghBAUVhdmh
tzjhT2ZWpF+WWshWF8ttEZUDnOsOxVA9xvEB5OAdPW+06RIUa4=
X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS,
KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE,
TXREP autolearn=no 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 <cygwin.cygwin.com>
List-Unsubscribe: <http://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <http://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
Errors-To: cygwin-bounces AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces AT cygwin DOT com>

Please don't "top-post".

Am 21.04.2020 um 17:14 schrieb Jack Adrian Zappa via Cygwin:
> Nm.  I figured it out.  Seems if you don't specify what type of
> listener, it'll default to IP4.  When you create a sender, it'll try
> first using IP6 and then fall back to IP4.  It's that first connection
> that is causing the failure.  If you specify the listener to use IP6,
> then it works fine.
OK, but what's the solution? How do you specify that in your scenario?
>
> Thanks,
>
> A
>
> On Tue, Apr 21, 2020 at 3:48 AM Jack Adrian Zappa <adrianh DOT bsc AT gmail DOT com> wrote:
>> 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

--
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

- Raw text -


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