Like Tree2Likes

RPC clnt_create fails with RPC_UNKNOWNPROTO error.

This is a discussion on RPC clnt_create fails with RPC_UNKNOWNPROTO error. within the C Programming forums, part of the General Programming Boards category; Consider the following code: Code: CLIENT *clnt = NULL; clnt = clnt_create("s4c",300456,1,"TCP"); if(clnt==NULL) clnt_pcreateerror("Client is\tNULL\n"); if(clnt!=NULL) printf("Client is\tCREATED\n"); if(rpc_createerr.cf_stat==RPC_INTR) printf("RPC_INTR\n"); ...

  1. #16
    Registered User
    Join Date
    Jan 2012
    Posts
    59
    Consider the following code:

    Code:
        CLIENT *clnt = NULL;
        clnt = clnt_create("s4c",300456,1,"TCP");
        if(clnt==NULL) clnt_pcreateerror("Client is\tNULL\n");
        if(clnt!=NULL) printf("Client is\tCREATED\n");
    
    
        if(rpc_createerr.cf_stat==RPC_INTR) printf("RPC_INTR\n");
        if(rpc_createerr.cf_stat==RPC_N2AXLATEFAILURE) printf("RPC_N2AXLATEFAILURE\n");
        if(rpc_createerr.cf_stat==RPC_SYSTEMERROR) printf("RPC_SYSTEMERROR\n");
        if(rpc_createerr.cf_stat==RPC_UNKNOWNHOST) printf("RPC_UNKNOWNHOST\n");
        if(rpc_createerr.cf_stat==RPC_UNKNOWNPROTO) printf("RPC_UNKNOWNPROTO\n");
    
    
        CLIENT *clnt1 = NULL;
        clnt1 = clnt_create("s4c",300456,1,"ncacn_ip_tcp");
        if(clnt1==NULL) clnt_pcreateerror("Client1 is\tNULL\n");
        if(clnt1!=NULL) printf("Client is\tCREATED\n");
    
    
        if(rpc_createerr.cf_stat==RPC_INTR) printf("RPC_INTR\n");
        if(rpc_createerr.cf_stat==RPC_N2AXLATEFAILURE) printf("RPC_N2AXLATEFAILURE\n");
        if(rpc_createerr.cf_stat==RPC_SYSTEMERROR) printf("RPC_SYSTEMERROR\n");
        if(rpc_createerr.cf_stat==RPC_UNKNOWNHOST) printf("RPC_UNKNOWNHOST\n");
        if(rpc_createerr.cf_stat==RPC_UNKNOWNPROTO) printf("RPC_UNKNOWNPROTO\n");
    
    
        CLIENT *clnt2 = NULL;
        clnt2 = clnt_create("192.168.1.2",300456,1,"tcp");
        if(clnt2==NULL) clnt_pcreateerror("Client2 is\tNULL\n");
        if(clnt2!=NULL) printf("Client is\tCREATED\n");
    
    
        if(rpc_createerr.cf_stat==RPC_UNKNOWNPROTO) printf("RPC_UNKNOWNPROTO\n");
        if(rpc_createerr.cf_stat==RPC_UNKNOWNHOST) printf("RPC_UNKNOWNHOST\n");
        if(rpc_createerr.cf_stat==RPC_SYSTEMERROR) printf("RPC_SYSTEMERROR\n");
        if(rpc_createerr.cf_stat==RPC_N2AXLATEFAILURE) printf("RPC_N2AXLATEFAILURE\n");
        if(rpc_createerr.cf_stat==RPC_INTR) printf("RPC_INTR\n");
    
    
        CLIENT *clnt4 = NULL;
        clnt4 = clnt_create("192.168.1.2:2000",300456,1,"tcp");
        if(clnt4==NULL) clnt_pcreateerror("Client4 is\tNULL\n");
        if(clnt4!=NULL) printf("Client is\tCREATED\n");
    
    
        if(rpc_createerr.cf_stat==RPC_UNKNOWNPROTO) printf("RPC_UNKNOWNPROTO\n");
        if(rpc_createerr.cf_stat==RPC_UNKNOWNHOST) printf("RPC_UNKNOWNHOST\n");
        if(rpc_createerr.cf_stat==RPC_SYSTEMERROR) printf("RPC_SYSTEMERROR\n");
        if(rpc_createerr.cf_stat==RPC_N2AXLATEFAILURE) printf("RPC_N2AXLATEFAILURE\n");
        if(rpc_createerr.cf_stat==RPC_INTR) printf("RPC_INTR\n");
    When I run it on a computer NOT connected to the RPC server it responds:

    Client is NULL
    : RPC: Port mapper failure - Timed out
    Client1 is NULL
    : RPC: Unknown protocol
    RPC_UNKNOWNPROTO
    Client2 is NULL
    : RPC: Port mapper failure - Timed out
    Client4 is NULL
    : RPC: Unknown host
    RPC_UNKNOWNHOST
    But when I run it on the computer connected to the RPC server I get This:

    Client is NULL
    : RPC: Unknown protocol
    RPC_UNKNOWNPROTO
    Client1 is NULL
    : RPC: Unknown protocol
    RPC_UNKNOWNPROTO
    Client2 is NULL
    : RPC: Unknown protocol
    RPC_UNKNOWNPROTO
    Client4 is NULL
    : RPC: Unknown protocol
    RPC_UNKNOWNPROTO
    Port 111 is the port mapper request port for if the RPC server is going to communicate to several different clients. It tells the clients which port to go to for RPC calls.
    I have the robot set to listen only to port 2000 because the 2 are hardwired together (1 server/1 client).

    I'll try nmap next.

  2. #17
    Registered User
    Join Date
    Jan 2012
    Posts
    59
    Just got your reply re: telnet port.
    I'm on my way.

  3. #18
    Registered User
    Join Date
    Jan 2012
    Posts
    59
    OK
    "telnet 192.168.1.2 111" connected.
    I thought 111 was the port mapper, for when the server has to keep track of multiple clients.
    I also thought I set it to not use a port mapper and instead respond to requests on port 2000.
    I'll check tomorrow because there's someone on the robot now until 11p.

  4. #19
    Registered User
    Join Date
    Jan 2012
    Posts
    59
    Wait a minute!
    Since:
    Code:
      clnt4 = clnt_create("192.168.1.2:2000",300456,1,"tcp");
    is not valid, how do I control which port to issue the request through?

  5. #20
    Registered User
    Join Date
    Jan 2012
    Posts
    59
    Haven't got NMAP up and running yet but I did run rpcinfo and it says that program 300456 version 1 is available and using tcp on port 1008.
    SO in order to specify the port I want to communicate on I'm trying to get clnttcp_create to work and that has lead to a whole different set of issues which I believe calls for a different thread.

    One more question here though. I did google it and have not come up with an effective query:

    consider the line of code:
    Code:
    clnt2 = clnt_create("192.168.1.2",300456,1,"tcp");
    To which port does this try to access?

  6. #21
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,426
    Just a guess, but I would assume it contacts the RPC server on port 111, gives it the program number and gets back the port. That's the only thing that makes sense to me given the way you're supposed to call that function. Unfortunately, I'm quickly running out of ideas for you, having only touched RPC code once for a small assignment in university some 10 or 12 years ago.

  7. #22
    Registered User
    Join Date
    Jan 2012
    Posts
    59
    Just realized my working directory was not in my Cygwin path.
    When I run the compiled exe in a Cygwin console WITH the path it creates the client.
    On to the next problem...

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. undefined reference to 'clnt_create'
    By evb@studioe.com in forum C Programming
    Replies: 15
    Last Post: 01-24-2012, 04:41 PM
  2. Replies: 7
    Last Post: 08-22-2011, 02:44 PM
  3. Replies: 10
    Last Post: 09-24-2010, 01:09 AM
  4. Why this fails?
    By manav in forum C++ Programming
    Replies: 13
    Last Post: 05-29-2008, 01:11 PM
  5. WriteFile() fails and returns strange error
    By Gerread in forum Windows Programming
    Replies: 7
    Last Post: 11-27-2007, 04:02 AM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21