4 #include <sys/socket.h>
8 main(argc,argv) int argc; char **argv; {
10 struct timeval pertry_timeout,total_timeout;
11 struct sockaddr_in server_addr;
15 enum clnt_stat clnt_stat;
18 if(argc < 3) fprintf(stderr,"usage:%s hostname version\n",argv[0]),exit(-1);
19 vers=(int)atol(argv[2]);
21 if((hp=gethostbyname(argv[1]))==NULL)
22 fprintf(stderr,"cannot get addr for %s\n",argv[1]),exit(-1);
24 pertry_timeout.tv_sec = 10;
25 pertry_timeout.tv_usec = 0;
27 addrlen = sizeof( struct sockaddr_in );
30 for( i=0; i<hp->h_length ; i++ )
31 ((char *)(&server_addr.sin_addr))[i] = hp->h_addr[i];
34 server_addr.sin_family = AF_INET;
35 server_addr.sin_port = 0;
37 total_timeout.tv_sec = 20;
38 total_timeout.tv_usec = 0;
40 if((client=clntudp_create(&server_addr,SRVRPROG,SRVRVERS+vers,total_timeout,&sock))==NULL){
41 perror("clntudp_create in stop");
45 clnt_stat=clnt_call(client,NULLPROC, xdr_void,NULL, xdr_void,NULL,
48 if( clnt_stat != RPC_SUCCESS ){
49 clnt_perror( client, "rpc clnt call" );
53 clnt_stat=clnt_call(client,SRVR_END, xdr_void,NULL, xdr_void,NULL,
56 if( clnt_stat != RPC_SUCCESS ){
57 clnt_perror( client, "rpc" );
61 clnt_destroy( client );