RPC clnt_create fails: unknown prototype.

When I run this (under Cygwin):
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <stdio.h>#include <stdlib.h>
#include "rap.h"
#include <rpc/rpc.h>


    clnt = clnt_create("s4c",300456,1,"TCP");
    if(clnt==NULL) printf("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");


it comes back:

Client is NULL
RPC_UNKNOWNPROTO

I've tried:
clnt = clnt_create("s4c",300456,1,"tcp");
clnt = clnt_create("s4c",300456,1,"TCP");
clnt = clnt_create("192.168.2.1",300456,1,"tcp");
clnt = clnt_create("192.168.2.1",300456,1,"TCP");

I have confirmed that both the client and server machines are running tcp/ip.
Last edited on
Is 300456 the port? If so, ports can only be in the range 1 to 65534. (Similar to the range of an unsigned short, but with the highest and lowest values reserved for reporting errors)
Last edited on
"s4c" == host
300456 == program number
1 == version number
"TCP" == protocol
Have you tried "localhost" or "localhost:<port>" while running the server on the same machine?
Last edited on
The server is and embedded Unix system.
The client is a Windows 7 PC.
I'm 100% sure the servers (there are 5 identical ones) are configured properly and it would be difficult to replicate them on the PC.
Turns out I was mistaken about which environment I was running under.
Although the .exe was compiled with the Cygwin compiler, when executed it ran in the windows command window. When executed in a Cygwin window (open the window and execute from the command line) the following line of code was successful:


clnt = clnt_create("192.168.2.1",300456,1,"tcp");
Topic archived. No new replies allowed.