⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rdict_clnt.cpp

📁 这是用c++编写的代码,用tcp,udp形式进行网络编程,代码很好.
💻 CPP
字号:
#include <string.h>
#include <rpc/rpc.h>

#define RPC_CLNT
#include "rdict.h"

/* Default timeout can be changed using clnt_control() */
static struct timeval TIMEOUT = { 25, 0 };

int *
initw_1(void *argp, CLIENT *clnt)
{
	static int res;

	memset((char *)&res, 0, sizeof(res));
	if (clnt_call(clnt, INITW, (xdrproc_t)xdr_void, (caddr_t)argp,
	    (xdrproc_t)xdr_int, (caddr_t)&res, TIMEOUT) != RPC_SUCCESS) {
		return (NULL);
	}
	return (&res);
}


int *
insertw_1(char **argp, CLIENT *clnt)
{
	static int res;

	memset((char *)&res, 0, sizeof(res));
	if (clnt_call(clnt, INSERTW, (xdrproc_t)xdr_wrapstring, (caddr_t)argp,
	    (xdrproc_t)xdr_int, (caddr_t)&res, TIMEOUT) != RPC_SUCCESS) {
		return (NULL);
	}
	return (&res);
}


int *
deletew_1(char **argp, CLIENT *clnt)
{
	static int res;

	memset((char *)&res, 0, sizeof(res));
	if (clnt_call(clnt, DELETEW, (xdrproc_t)xdr_wrapstring, (caddr_t)argp,
	    (xdrproc_t)xdr_int, (caddr_t)&res, TIMEOUT) != RPC_SUCCESS) {
		return (NULL);
	}
	return (&res);
}


int *
lookupw_1(char **argp, CLIENT *clnt)
{
	static int res;

	memset((char *)&res, 0, sizeof(res));
	if (clnt_call(clnt, LOOKUPW, (xdrproc_t)xdr_wrapstring, (caddr_t)argp,
	    (xdrproc_t)xdr_int, (caddr_t)&res, TIMEOUT) != RPC_SUCCESS) {
		return (NULL);
	}
	return (&res);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -