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:date:from:to:subject:message-id:reply-to :references:mime-version:content-type:in-reply-to; q=dns; s= default; b=VLV2PxNHX1EgKTDIC1n2JbEsTf5Xp0HnngXwFZJWmzE6lJ0gfKc24 iga+Wxtz69j95IIgx5+3/yLMwkguXTzKvQQVCZ1OPPBCfCO2vqY+8o58/8Z6thde BQaHdFMrt/DkE/Ey5Oqy66cPcTi9Mlr+zlBlfLdJkquoqRl4KMUnyM= 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:date:from:to:subject:message-id:reply-to :references:mime-version:content-type:in-reply-to; s=default; bh=ZhbRTNxWDK+/nkNv+AthuDKn+0w=; b=NWTxsZX94Lw4ff4HyUTFt6G5l0ej Zr6waimu7u8Ep+XX8FJ1bIlQSBxSV6371zgdxIioioHazUaFqkE+gHP4/9nR7csu q5qXHfVEwzMJ+JSv1UXN1GS1vN9E59NDvXa5PgF1FGyDDvV0nVHsJQAss+Ib8O4Z oiyH7go3EvVdZyo= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , 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-Virus-Found: No X-Spam-SWARE-Status: No, score=-101.9 required=5.0 tests=AWL,BAYES_00,GOOD_FROM_CORINNA_CYGWIN,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=H*R:D*cygwin.com X-HELO: drew.franken.de Date: Wed, 31 Jan 2018 10:10:53 +0100 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: RPC clnt_create() adress already in use Message-ID: <20180131091053.GA4223@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <59D90AF8D70E9740907BACDE2BCB520836E01220 AT RESW102 DOT resdom01 DOT local> <812cb3b6-9d28-971c-45eb-38421d817ca4 AT maxrnd DOT com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="gKMricLos+KVdGMg" Content-Disposition: inline In-Reply-To: <812cb3b6-9d28-971c-45eb-38421d817ca4@maxrnd.com> User-Agent: Mutt/1.9.1 (2017-09-22) --gKMricLos+KVdGMg Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Jan 31 00:15, Mark Geisert wrote: > PAULUS, Raimund, TI-ABN wrote: > > Hi Mark, > >=20 > > in my email (https://sourceware.org/ml/cygwin/2017-12/msg00194.html) i = described 2 approaches. I prefer nr 1. > > Here the part of the source in bindresvport.c: > > [...] > > This causes bind() to search an unused port. I use libtirpc with this f= ix since several weeks and it works for me. I don't know an other way (fixi= ng Cygwin) to success. > > The RPC-client on my pc is started every few minutes and has to connect= to the RPC-server. Without the fix libtirpc is not usable and I have to u= se Cygwin 1.5.18 with the old librpc. > [...] >=20 > Hi Raimund, > Thanks for attaching the complete source for your modified bindresvport.c. > I had been treating your setting of port to 0 as a workaround rather than= as > a solution. My misunderstanding. >=20 > We can't solve the issue that way because when bind() is called with a > zeroed port number, it picks a random port number that's often outside the > range of ports bindresvport() is supposed to return (i.e., a port between > STARTPORT and ENDPORT). >=20 > I thought of something similar to your idea but obeying the bindresvport() > semantics. I add a static short value named 'usecount' to the function's > local variables. Mid-function, I have this code to choose a port number: > if (port =3D=3D 0) { > port =3D ((getpid() + usecount++) % NPORTS) + STARTPORT; > } >=20 > Can you try this with your testcase(s) and make sure it works for you? I'm a bit puzzled here in terms of using your own bindresvport. Cygwin implements bindresvport{_sa} for quite some time, 2006 or earlier. Corinna --=20 Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat --gKMricLos+KVdGMg Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEoVYPmneWZnwT6kwF9TYGna5ET6AFAlpxiB0ACgkQ9TYGna5E T6CGbA//W3UU599RZVcZh6X+LLZR0+QPS1oOPUutnFNB1fNeyTaiK84YFRIaDEBl dEAsmmW/0m4bxvJ4veOGkdxO3CVRwBfROul+0lqFgFRDgvP8ivsvBfDjBQTXFYVn fYvXKpJ89VRTl23MeRpOFJlxSfnCPWuFbUzP6rqQe62XGUcpiS5L71K3wOQqg3Uz Gu69cDRX5ZFnUvgxfCLw25M4ikqUblFihfkl+ly46lIpELJeX8W/X930G0Vzd5JU XXvMCO+7utmMoGjDimoeAmDwzae+FJlXN/FcTVIafAKKdenxRXywMRzm4rqulTAg dP6R2AL9dvg2fQTYTuI9/nzrn9cf/nqTi0U7R//xE+mizyESbDCpgnQO3K0T/GR+ WfJtvYroZa5YibjwQMMefc/TsdyALEOe9nadMxaBCsNoJ09b3qOe+cj1a3YKhQBk jSLcG8qHoOet9+o4THdbOr2wx1wr6VV3vYR+13bkRiLnSN5JldWRbIncNG6QTnEp Tl0JzwGoRx8tZ3T8jx09P2QSlOeNaCDYB+e1v1hbsfj2MRoYZV3s7WAN2ykRZ2bm QaHnknVFhzV+qhyThXZURZKdgwNQVhJROkn1vv4srlLLur+LwcB9DUfe5fxInBrd 9Zey+l6YlKWQWp2rgHEsDkexhZfPkOZHgiFe8lHfr69zS5b3iTk= =gDD5 -----END PGP SIGNATURE----- --gKMricLos+KVdGMg--