From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 82667 invoked by alias); 22 Sep 2017 07:22:08 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 82583 invoked by uid 89); 22 Sep 2017 07:22:03 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: Yes, score=5.3 required=5.0 tests=AWL,BAYES_00,HTML_MESSAGE,KAM_INFOUSMEBIZ,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_NONE autolearn=no version=3.3.2 spammy=H*MI:local, H*M:local, adress, Connection X-HELO: mailrelay.dillinger.de Received: from mailrelayb.dillinger.de (HELO mailrelay.dillinger.de) (212.184.64.29) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 22 Sep 2017 07:21:58 +0000 Received: from mailrelaya2.dillinger.de (mailrelaya [192.168.175.11]) by lin254mailrelayb.dillinger.de (Postfix) with ESMTP id A6A23A3D0 for ; Fri, 22 Sep 2017 09:21:56 +0200 (CEST) Received: from lin275.int.shsservices.de (lin275 [172.18.32.6]) by mailrelaya2.dillinger.de (Postfix) with ESMTP id 0992424235F for ; Fri, 22 Sep 2017 09:28:34 +0200 (CEST) Received: from RESW103.resdom01.local (resw103.dillinger.de [172.18.22.103]) by lin275.int.shsservices.de (Postfix) with ESMTP id 8DDA6F3EB2 for ; Fri, 22 Sep 2017 09:21:56 +0200 (CEST) Received: from RESW102.resdom01.local ([fe80::a883:3db9:4459:1159]) by RESW103.resdom01.local ([fe80::a480:c1ef:e5bb:a91b%15]) with mapi id 14.03.0279.002; Fri, 22 Sep 2017 09:21:56 +0200 From: "PAULUS, Raimund, TI-ABN" To: "'cygwin@cygwin.com'" Subject: RPC clnt_create() adress already in use Date: Fri, 22 Sep 2017 07:22:00 -0000 Message-ID: <59D90AF8D70E9740907BACDE2BCB5208365F7F6C@RESW102.resdom01.local> Content-Type: multipart/alternative; boundary="_000_59D90AF8D70E9740907BACDE2BCB5208365F7F6CRESW102resdom01_" MIME-Version: 1.0 X-IsSubscribed: yes X-SW-Source: 2017-09/txt/msg00203.txt.bz2 --_000_59D90AF8D70E9740907BACDE2BCB5208365F7F6CRESW102resdom01_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Content-length: 5224 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 (Remo= te Procedure Call) are running, one service for one Windows-PC each. To bui= ld 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, e= stablishes a connection to the server (clnt_create), executes a few calls t= o the server (clnt_call), closes the connection (clnt_destroy) and exits. T= he time-interval between the program starts can be 10 seconds up to 2 minut= es. 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 prob= lems. 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 wrote a program for tests in Cygwin 1.5.18, 1.7.32 and 2.5.1: The program reads argv[1] as a sleeptime. If no argv[1] exists, sleeptime h= as a default value of 10 seconds. Afterwards is a loop (20 times) of the f= ollowing actions: - establish a connection to the server and sleep for 1 second - destroy the connection - sleep(sleeptime) test_rpc.c: /*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/ /* Include-Files */ /*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/ #include #include #include #include #include #include #include /*#include */ #include #include #include /*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/ /* global definitions = */ /*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/ char local_errmsg[512]; char host[] =3D "nazv"; u_int prognum =3D 0x2000002F; u_int versnum =3D 2; char nettype[] =3D "tcp"; /*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D*/ /* main-program */ /*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D*/ int main (int argc, char *argv[]) { int retval =3D 0; int sleeptime =3D 0; CLIENT *cl; /* a client handle */ // read sleep-Time if(argc < 2) { printf("no input for sleep-Time --> default\n"); sleeptime =3D 10; } else { char *endptr; errno =3D 0; sleeptime =3D (int)strtol(argv[1], &endptr, 10); if ( (errno =3D=3D ERANGE && (sleeptime =3D=3D LONG_MAX || sleeptime = =3D=3D LONG_MIN)) || (errno !=3D 0 && sleeptime =3D=3D 0)) { fprintf(stderr, "input for sleeptime (%s) invalid: %s\n", argv[1], strerror(errno)); exit(1); } } printf("sleep-Time =3D %d \n", sleeptime); // loop for 20 connection for(int i=3D0; i<20; i++) { if(!(cl =3D clnt_create(host, prognum, versnum, nettype))) { // couldn't start client handle sprintf(local_errmsg, "%s: %s", host, clnt_spcreateerror("clnt_create= ")); retval =3D -1; break; } printf("connection nr. %d established \n", i+1); sleep(1); clnt_destroy(cl); printf("connection closed\n"); printf("wait for %d sec.\n", sleeptime); sleep(sleeptime); }; if(retval < 0) fprintf(stderr, "%s\n", local_errmsg); return(0); } // end main() Test 1: The program is started with argument "60" (sleep =3D 60 secs.) Results: Cygwin 1_5_18 (Windows XP, Windows 7) The loop is completed without error (20 times the connection was opened and= closed). Cygwin 1_7_32 and 2_5_1 (Windows 7) After the first connection is closed, a second connection in the loop is no= t possible (error message above) and the program exits. RPC-Client on Linux (openSuSe Leap 42.1) The loop is completed without error (20 times the connection was opened and= closed). Test 2: The program is started with argument "0" (sleep =3D 0 secs.) Results: Cygwin 1_5_18 (Windows XP, Windows 7) The loop is completed without error (20 times the connection was opened and= closed). Cygwin 1_7_32 and 2_5_1 (Windows 7) After the first connection is closed, a second connection in the loop is no= t possible (error message above) and the program exits. RPC-Client on Linux (openSuSe Leap 42.1) The loop is completed without error (20 times the connection was opened and= closed). Test 3: The program is started with argument "0" (sleep =3D 0 secs.) Windows 7 only Cygwin 1_7_32 and 2_5_1 After the program exited with the error, the program was immediately restar= ted. The start was ok (but always the program exited with the known error).= But after several starts a new error was there: Remote system error - Connection timed out What is the reason for the error? I have to develop RPC-Clients for Windows= XP SP3 and Windows 7. Raimund Paulus --_000_59D90AF8D70E9740907BACDE2BCB5208365F7F6CRESW102resdom01_--