Find the answer to your Linux question:
Results 1 to 4 of 4
Hello, We have an RPC program running on RHEL-5. both client and server are continuously running programs. After some time ( 15 hours ), client connection time out in clnt_create ...
  1. #1
    Just Joined!
    Join Date
    Jul 2010
    Posts
    2

    RPC Problem with RHEL 5

    Hello,
    We have an RPC program running on RHEL-5.
    both client and server are continuously running programs.
    After some time ( 15 hours ),
    client connection time out in clnt_create call for 3/5 timeouts
    after that clnt_create fails with error message unknown host.

    ----RPC Prog-------------
    program MYHLTPROG {
    version MYHLTVERS {
    int GETNODESTAT(void)=1;
    }=1;
    }=0x20000090;
    ----------------------------

    Please help.

    Thanks in Advance.
    Siva

  2. #2
    Linux Guru coopstah13's Avatar
    Join Date
    Nov 2007
    Location
    NH, USA
    Posts
    3,149
    probably there is a problem in your application's code, you should add some logging information to it so you can debug and find the problems

  3. #3
    Just Joined!
    Join Date
    Jul 2010
    Posts
    2

    please find the code below :

    Hello,

    Thank you very much for your response. Please take a look at the sample code which is generating the error. Please help.

    Thanks in advance again,
    Siva


    client :
    ----------------------------------------------------------------------------
    #include <stdio.h>
    #include <rpc/rpc.h>
    #include <time.h>
    #include "myhlt.h"

    main(int argc, char *argv[])
    {
    CLIENT *cl;
    int *result;
    char *server;
    char *message;

    if (argc != 2) { printf("usage %s host message\n",argv[0]); }
    server = argv[1];

    while(1)
    {
    cl = clnt_create(server, MYHLTPROG, MYHLTVERS, "tcp");
    if (cl == NULL) {
    clnt_pcreateerror(server);
    sleep(30);
    continue;
    }
    result = getnodestat_1 ((void *) NULL, cl);
    if (result == NULL) {
    clnt_perror(cl, server);
    sleep(30);
    continue;
    }
    if (*result == 0) {
    sleep(30);
    continue;
    }
    printf(" got response from the server\n");
    sleep(60);
    }
    exit(0);
    }
    ---------------------------------------------------------------------
    server:
    -------------------------------------------------------------------#include <stdio.h>
    #include <rpc/rpc.h>
    #include <time.h>
    #include "myhlt.h"
    int * getnodestat_1(void *m,CLIENT *cl)
    {
    static int result; /* must be static! */
    result = 1;
    return(&result);
    }

    int * getnodestat_1_svc(void *m,struct svc_req *s)
    {
    static int result; /* must be static! */
    result = 1;
    return(&result);
    }
    ----------------------------------

    Makefile
    --------------------------------------------------------------------------------------
    ALL: rpc1 myclient myserver

    rpc1: myhlt.x
    rpcgen myhlt.x
    myclient: myhltcli.c
    cc -o myclient myhltcli.c myhlt_clnt.c
    myserver: myhlt_proc.c
    cc -o myserver myhlt_proc.c myhlt_svc.c

    clean:
    rm -f myhlt_clnt.c myhlt_svc.c myclient myserver *.h


    --------------------------------------------------------------------------------------

  4. #4
    Linux Guru coopstah13's Avatar
    Join Date
    Nov 2007
    Location
    NH, USA
    Posts
    3,149
    post code inside code tags

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...