| 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 | |
| :mime-version; q=dns; s=default; b=EwfnSxJNoMIFPTNDyzsEMC1qA6jKc | |
| 836FFTFvihbzJOQndNITZKto6bjZJrYtPlrwbA8LQI9/Kcm+Qto2JZp9GV5m4cp4 | |
| 7t5yID2+hUz0THZTLpiV6by3b24VWrawkXSdBBYsxyVvqt14YU/W12YBz/wdx91O | |
| cHMKmRBDr4kjpo= | |
| 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 | |
| :mime-version; s=default; bh=4umcntAvq+Ii35nA/hwfxsn1tyc=; b=NNK | |
| SUIrHn6XCJNs9rK4vyBI0ts/PaCS9NJ/q83PuxcszsWZ/CkVa6qFdgLIfWB6/9U/ | |
| OQCFeH1MpA+Z0bTrf4OYz274j4fUm0P8phPV/ZJo6Betil5qswdFtbwBqU9JAdx3 | |
| LRCRii+EqopkbF1UjXq5Z6bW//oaui1KQNaUICgc= | |
| 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: | 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 |
| From: | "PAULUS, Raimund, TI-ABN" <Raimund DOT Paulus AT dillinger DOT biz> |
| To: | "'cygwin AT cygwin DOT com'" <cygwin AT cygwin DOT com> |
| Subject: | RPC clnt_create() adress already in use |
| Date: | Fri, 22 Sep 2017 07:21:56 +0000 |
| Message-ID: | <59D90AF8D70E9740907BACDE2BCB5208365F7F6C@RESW102.resdom01.local> |
| MIME-Version: | 1.0 |
| X-IsSubscribed: | yes |
--_000_59D90AF8D70E9740907BACDE2BCB5208365F7F6CRESW102resdom01_
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
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 <stdio.h>
#include <stdlib.h>
#include <curses.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
/*#include <posix.h>*/
#include <sys/types.h>
#include <sys/stat.h>
#include <rpc/rpc.h>
/*=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_--
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |