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:to:subject:date:message-id:content-type :content-transfer-encoding:mime-version; q=dns; s=default; b=NLY 0H+vCQ1YXfZqChg/HSxoixkras2STDvdNzZseyLfvkRRVaXlaNtefL49gHkrMVRZ XQrWoZQLsq9QK267tRKUFMakNvUdMeDkgHcQikG2O/lId1Qvv3hQJjsj7KPr96Ar ReujHEv5icXJzq0tyWly8yykLNA0bxtEe66cit8k= 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:to:subject:date:message-id:content-type :content-transfer-encoding:mime-version; s=default; bh=x4OTna+oP JUmv0vP2axHCHaKYlE=; b=ueymF/oNzRBdPikRaS0fi3Sa/Q0u9OHM8CyuvmDDt dKjMC6JCvUwUDRX0qR1PGkKO8azpaLmJnPaztYp2IwAX1FgcxAq5zrXd8GGU64al +7D37GWfpOG1lv7G7XCAj/adNkH0zNrxsU6ArxGMxyenzAVsmIVS8TuONO9C64+g zo= 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=2.1 required=5.0 tests=AWL,BAYES_50,CYGWIN_OWNER_BODY,GIT_PATCH_2,KAM_INFOUSMEBIZ,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_NONE autolearn=no version=3.3.2 spammy=H*MI:local, H*M:local, adress, clnt_create X-HELO: mailrelay.dillinger.de From: "PAULUS, Raimund, TI-ABN" To: "'cygwin AT cygwin DOT com'" Subject: AW: RPC clnt_create() adress already in use Date: Mon, 25 Sep 2017 06:18:54 +0000 Message-ID: <59D90AF8D70E9740907BACDE2BCB52083660695A@RESW103.resdom01.local> Content-Type: text/plain; charset="iso-8859-1" MIME-Version: 1.0 X-IsSubscribed: yes Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id v8P6JEgh027776 Hallo Mark Geisert, many thanks for your answer. I supposed this too. I included in my source code the following function calls after clnt_create(): int fd = 0; bool bool_ret = clnt_control(cl, CLGET_FD, &fd); if(bool_ret == true) { printf("fd: %d\n", fd); int enable = 1; retval = setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &enable, sizeof(int)); if(retval < 0) fprintf(stderr, "Fehler setsockopt(): %s\n", strerror(errno)); } The function clnt_control() delivers the socket of the RPC-Client-Handle. The result is the same as before. Moreover i think, the effect of setsockopt() would be valid only during the process is running (my test scenarios 1 and 2). But it wouldn't change anything regarding my test scenario 3 (several restarts). Raimund -----Ursprüngliche Nachricht----- Von: cygwin-owner AT cygwin DOT com [mailto:cygwin-owner AT cygwin DOT com] Im Auftrag von Mark Geisert Gesendet: Sonntag, 24. September 2017 11:49 An: cygwin AT cygwin DOT com Betreff: Re: RPC clnt_create() adress already in use 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 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 -- 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