| delorie.com/archives/browse.cgi | search |
| 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=i4W | |
| vnkwZTrIPL0aLOB/U1dVmA4/YcLQm/T0aHimdbJnFpTSHDmMtnxWJdM1ljL7z488 | |
| zZW5x0jkja/tTa8436Iw6wZBmUF3QxXuemY/5P118apMlNK8jUokB/sjxARoM6VM | |
| eQ5pK0BLQghgAF3rrn38ufrYH9bb+IBnVNrNjv4s= | |
| 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=6tnIsK70x | |
| 52tawqafs5wzSjGM3w=; b=ylThO7Nkz3SXDmW556Nda/7rS+TpGH+nAXU1iSlt1 | |
| drK61+zdPtNfRReFAc++EZsHj+Nu2Q4gnilqWXiCTedaCiIxsbeIY4CB072YiZ/9 | |
| meF7BsmLVK1um9afDg/9aYF7kQL0inA9mMq9xWaN+p91xCaCRBHF9GqK4pT2fay2 | |
| Xs= | |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Id: | <cygwin.cygwin.com> |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sourceware.org/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
| 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=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 |
| From: | "PAULUS, Raimund, TI-ABN" <Raimund DOT Paulus AT dillinger DOT biz> |
| To: | "'cygwin AT cygwin DOT com'" <cygwin AT cygwin DOT com> |
| Subject: | Re: RPC clnt_create() adress already in use |
| Date: | Wed, 27 Sep 2017 12:50:48 +0000 |
| Message-ID: | <59D90AF8D70E9740907BACDE2BCB52083662AC7B@RESW102.resdom01.local> |
| MIME-Version: | 1.0 |
| X-IsSubscribed: | yes |
| X-MIME-Autoconverted: | from quoted-printable to 8bit by delorie.com id v8RCpC79012812 |
Hello Mark,
i compiled and linked just as you.
As i mentioned in an other email, if I use socket-connections in the same manner with a socket-service, in don't need to setsockopt(.., SO_REUSEADDR, ...) and it works.
Raimund
-----Ursprüngliche Nachricht-----
Von: cygwin-owner AT cygwin DOT com [mailto:cygwin-owner AT cygwin DOT com] Im Auftrag von Mark Geisert
Gesendet: Mittwoch, 27. September 2017 11:50
An: cygwin AT cygwin DOT 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_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
I looked through the libtirpc source code and nowhere is SO_REUSEADDR being set.
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 libtirpc 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 have a local machine running RPC services and don't wish to poke at random machines 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 taking care to compile against the correct RPC-package includes and link against 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 pieces such that you could set the socket option before bind() is called. That would be a fair amount of work though and given my cursory look at the source 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
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |