5 #include <sys/socket.h>
9 main(argc,argv) int argc; char **argv; {
11 struct timeval pertry_timeout,total_timeout;
12 struct sockaddr_in server_addr;
16 enum clnt_stat clnt_stat;
21 if(argc < 3) fprintf(stderr,"usage:%s hostname version\n",argv[0]),exit(-1);
23 vers=(int)atol(argv[2]);
25 if((hp=gethostbyname(argv[1]))==NULL)
26 fprintf(stderr,"cannot get addr for %s\n",argv[1]),exit(-1);
28 pertry_timeout.tv_sec = 60;
29 pertry_timeout.tv_usec = 0;
31 addrlen = sizeof( struct sockaddr_in );
34 for( i=0; i<hp->h_length ; i++ )
35 ((char *)(&server_addr.sin_addr))[i] = hp->h_addr[i];
38 server_addr.sin_family = AF_INET;
39 server_addr.sin_port = 0;
41 total_timeout.tv_sec = 2000;
42 total_timeout.tv_usec = 0;
44 if((client=clntudp_create(&server_addr,SRVRPROG,SRVRVERS+vers,total_timeout,&sock))==NULL){
45 perror("clntudp_create");
49 clnt_stat=clnt_call(client,NULLPROC, xdr_void,NULL, xdr_void,NULL,
52 if( clnt_stat != RPC_SUCCESS ){
53 clnt_perror( client, "rpc clnt call" );
59 for( i=0; i<500; i++ ){
62 sprintf(s,"client %d version %d",pid,vers);
64 clnt_stat = clnt_call( client, RENDERSTR,
65 xdr_wrapstring, &s, xdr_void, NULL,
68 if( clnt_stat != RPC_SUCCESS ){
69 clnt_perror(client,"rpc");
76 clnt_destroy( client );