我尝试用ubuntu中的RPC编程一个新程序,服务器执行正常但我总是得到错误:执行客户端之后的分段错误(Core dumped)这是我的代码
banque.x
const max_cin = 8;
typedef string typeCin<max_cin>;
struct client {
typeCin cin;
float solde;
};
typedef struct client client;
struct cnMysql{
char * host;
char * user;
char * pass;
};
typedef struct cnMysql cnMysql;
program BANQUE {
version Client {
string Connect(cnMysql cn) = 0;
string AddC(client c) = 1;
client ConC(typeCin cin) = 2;
string AddS(client c) = 3;
}=0;
}=20162016;
banque_server.c
char **
connect_0_svc(cnMysql *argp, struct svc_req *rqstp)
{
static char * result;
result = "test";
return &result;
}
banque_client.c
// declaration
CLIENT *clnt;
char * *result_1;
cnMysql connect_0_arg;
char * *result_2;
client addc_0_arg;
client *result_3;
typeCin conc_0_arg;
char * *result_4;
client adds_0_arg;
//end declaration
//main
connect_0_arg.host = "localhost";
connect_0_arg.user = "root";
connect_0_arg.pass = "root";
result_1 = connect_0(&connect_0_arg, clnt);