X-Recipient: archive-cygwin@delorie.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:subject:to:references:from:message-id:date
	:mime-version:in-reply-to:content-type
	:content-transfer-encoding; q=dns; s=default; b=DsOAtf586Y4uh7F4
	ODgaPZznPzvRwCnCPsGV8+JdTH8uqNBUoPliNu9TxK557XmzJL9axfwYOaEzc92i
	bVjzsPXer9YtQok8niK/m0tut+lHgodHPQJLbJ0vJAgZkcHlSVi/AAXlIAPQ8IOE
	ndXEWq4+3Vhr2yEh0+Q19q/f5T4=
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:subject:to:references:from:message-id:date
	:mime-version:in-reply-to:content-type
	:content-transfer-encoding; s=default; bh=YarUFZ/OwlgrYjyZnAriAm
	wlf/g=; b=HmOl7SlIpdo3vzMrLaaTbe664gV2iC8teWbwr816oCyrm3WPU6mDes
	oYdUOO9CAWRTlUE/kKGXOjC2QgTnYgoMqj0jsrWa+iOiRcL75eWR3Eg5qDPphNS2
	Vmysfu/NhBBeKqejwZJGdoEw1jEXG78rx61bEl6HXZ4Zez85INnHo=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=2.3 required=5.0 tests=AWL,BAYES_60,KAM_LAZY_DOMAIN_SECURITY autolearn=no version=3.3.2 spammy=RPC, adress, windowspcs, clnt_call
X-HELO: m0.truegem.net
Subject: Re: RPC clnt_create() adress already in use
To: cygwin@cygwin.com
References: <59D90AF8D70E9740907BACDE2BCB5208365F7F6C@RESW102.resdom01.local>
From: Mark Geisert <mark@maxrnd.com>
Message-ID: <4c0d1ba5-d314-744b-e094-80e540c9203a@maxrnd.com>
Date: Sun, 24 Sep 2017 02:49:24 -0700
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:49.0) Gecko/20100101 Firefox/49.0 SeaMonkey/2.46
MIME-Version: 1.0
In-Reply-To: <59D90AF8D70E9740907BACDE2BCB5208365F7F6C@RESW102.resdom01.local>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

PAULUS, Raimund, TI-ABN wrote:
> In our environment we have a Linux-Server and several Windows-PCs (Windows XP SP3, in the past Windows NT too). On the Linux-Server RPC-Services (Remote Procedure Call) are running, one service for one Windows-PC each. To build the RPC-clients on the Windows-boxes, I used Cygwin 1.5.18 and actually Cygwin 2.5.1 (because we now have Windows 7 too).
>
> The RPC-Client (*.exe) on the Windows-box is started at any time by hand, establishes a connection to the server (clnt_create), executes a few calls to the server (clnt_call), closes the connection (clnt_destroy) and exits. The time-interval between the program starts can be 10 seconds up to 2 minutes.
>
> This worked over many years without any error (Cygwin 1.5.18).
> Now I upgraded to Cygwin 2_5_1 (libtirpc instead librpc) and there are problems. Sometimes the RPC-Client cannot establish a connection to the server. The error message from clnt_spcreateerror():
>
> Remote system error - Address already in use
>
> I think it is "EADDRINUSE".

I can only answer generally as I haven't tried your testcase and don't know 
anything about either RPC library on Cygwin.  If EADDRINUSE is the error you're 
getting, it might be due to a difference between libtirpc and the older librpc. 
When a program binds a specific address and port to a socket, uses the socket 
then later closes it, the system keeps the <address, port> tuple in a "locked" 
state until enough time has passed for the other end of the connection to notice 
the connection's been closed.  During that time, attempting to bind() with the 
same address and port will result in EADDRINUSE.  It's a TCP/IP safety mechanism.

If you wish to override that behavior, you set a specific option SO_REUSEADDR on 
the socket with setsockopt() before you issue the bind().  Perhaps libtirpc is 
not doing that, though librpc was doing that.  Only way to know is to examine 
the source to both libraries.  It's possible an strace of a broken session 
compared to an strace of a working session might shed some light.

..mark


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

