From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5181 invoked by alias); 27 Sep 2017 12:51:02 -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 128690 invoked by uid 89); 27 Sep 2017 12:50:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=1.7 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, adress, hallo, delivers 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; Wed, 27 Sep 2017 12:50:51 +0000 Received: from mailrelaya2.dillinger.de (mailrelaya [192.168.175.11]) by lin254mailrelayb.dillinger.de (Postfix) with ESMTP id A54DE1D2002 for ; Wed, 27 Sep 2017 14:50:49 +0200 (CEST) Received: from lin275.int.shsservices.de (lin275 [172.18.32.6]) by mailrelaya2.dillinger.de (Postfix) with ESMTP id E5607242378 for ; Wed, 27 Sep 2017 14:57:33 +0200 (CEST) Received: from RESW103.resdom01.local (resw103.dillinger.de [172.18.22.103]) by lin275.int.shsservices.de (Postfix) with ESMTP id 8C6E9F3BCC for ; Wed, 27 Sep 2017 14:50:49 +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; Wed, 27 Sep 2017 14:50:50 +0200 From: "PAULUS, Raimund, TI-ABN" To: "'cygwin@cygwin.com'" Subject: Re: RPC clnt_create() adress already in use Date: Wed, 27 Sep 2017 12:51:00 -0000 Message-ID: <59D90AF8D70E9740907BACDE2BCB52083662AC7B@RESW102.resdom01.local> Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-IsSubscribed: yes X-SW-Source: 2017-09/txt/msg00277.txt.bz2 Hello Mark, i compiled and linked just as you. As i mentioned in an other email, if I use socket-connections in the same m= anner with a socket-service, in don't need to setsockopt(.., SO_REUSEADDR, = ...) and it works. Raimund -----Urspr=FCngliche Nachricht----- Von: cygwin-owner@cygwin.com [mailto:cygwin-owner@cygwin.com] Im Auftrag vo= n Mark Geisert Gesendet: Mittwoch, 27. September 2017 11:50 An: cygwin@cygwin.com Betreff: Re: RPC clnt_create() adress already in use Hello Raimund, Let's keep this on the mailing list please. PAULUS, Raimund, TI-ABN wrote: > Hallo Mark Geisert, > > many thanks for your answer. I supposed this too. > > I included in my source code the following function calls after clnt_crea= te(): > > int fd =3D 0; > bool bool_ret =3D clnt_control(cl, CLGET_FD, &fd); if(bool_ret =3D=3D tru= e) { > printf("fd: %d\n", fd); > > int enable =3D 1; > retval =3D 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 setsock= opt() 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 res= tarts). > > Raimund I looked through the libtirpc source code and nowhere is SO_REUSEADDR being= set.=20 You are on the right track with how to do it, but by the time clnt_create= () returns to you it is already too late. As far as I can tell there is no= way to get access to the socket between the time it's created within libti= rpc and the time it's made available to you by clnt_create(). I did try running your testcase (thanks for supplying that) but I don't hav= e a local machine running RPC services and don't wish to poke at random mac= hines on the Internet ;-). I had to compile it as so: gcc -g -o test_rpc -I/usr/include/tirpc test_rpc.c -ltirpc You are tak= ing care to compile against the correct RPC-package includes and link again= st the correct RPC-package libraries, yes? Speculation: There might be a way to decompose what clnt_create() does into= other libtirpc functions that accomplish the same thing, but in smaller pi= eces such that you could set the socket option before bind() is called. Th= at would be a fair amount of work though and given my cursory look at the s= ource I don't know if it's even possible. ..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