This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RPC clnt_create() adress already in use

On Jan 31 00:15, Mark Geisert wrote:
> PAULUS, Raimund, TI-ABN wrote:
> > Hi Mark,
> > 
> > in my email ( i described 2 approaches. I prefer  nr 1.
> > Here the part of the source in bindresvport.c:
> > [...]
> > This causes bind() to search an unused port. I use libtirpc with this fix since several weeks and it works for me. I don't know an other way (fixing Cygwin) to success.
> > The RPC-client on my pc is started every few minutes and has to connect to the RPC-server.  Without the fix libtirpc is not usable and I have to use Cygwin 1.5.18 with the old librpc.
> [...]
> Hi Raimund,
> Thanks for attaching the complete source for your modified bindresvport.c.
> I had been treating your setting of port to 0 as a workaround rather than as
> a solution.  My misunderstanding.
> We can't solve the issue that way because when bind() is called with a
> zeroed port number, it picks a random port number that's often outside the
> range of ports bindresvport() is supposed to return (i.e., a port between
> I thought of something similar to your idea but obeying the bindresvport()
> semantics.  I add a static short value named 'usecount' to the function's
> local variables.  Mid-function, I have this code to choose a port number:
>     if (port == 0) {
>         port = ((getpid() + usecount++) % NPORTS) + STARTPORT;
>     }
> Can you try this with your testcase(s) and make sure it works for you?

I'm a bit puzzled here in terms of using your own bindresvport.  Cygwin
implements bindresvport{_sa} for quite some time, 2006 or earlier.


Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

Attachment: signature.asc
Description: PGP signature

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]