資源簡介
rpc (網絡通信例子)c語言(親自測試過可以使用)
代碼片段和文件信息
/*
?*?This?is?sample?code?generated?by?rpcgen.
?*?These?are?only?templates?and?you?can?use?them
?*?as?a?guideline?for?developing?your?own?functions.
?*/
#include?“test.h“
#include?“stdio.h“
void
testprog_1(char?*host)
{
CLIENT?*clnt;
char?*?*result_1;
char?*?test_1_arg;
#ifndef DEBUG
clnt?=?clnt_create?(host?TESTPROG?VERSION?“udp“);
if?(clnt?==?NULL)?{
clnt_pcreateerror?(host);
exit?(1);
}
#endif /*?DEBUG?*/
result_1?=?test_1(&test_1_arg?clnt);
if?(result_1?==?(char?**)?NULL)?{
clnt_perror?(clnt?“call?failed“);
}
printf(“client?get?message::%s“*result_1);
#ifndef DEBUG
clnt_destroy?(clnt);
#endif ?/*?DEBUG?*/
}
int
main?(int?argc?char?*argv[])
{
char?*host;
if?(argc?2)?{
printf?(“usage:?%s?server_host\n“?argv[0]);
exit?(1);
}
host?=?argv[1];
testprog_1?(host);
exit?(0);
}
- 上一篇:Hilbert變化的C語言實現
- 下一篇:教學計劃編制系統文檔
評論
共有 條評論