亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? rpc.prog.ms

?? 早期freebsd實現
?? MS
?? 第 1 頁 / 共 5 頁
字號:
		bool = TRUE;	else		bool = FALSE;	if (!svc_sendreply(transp, xdr_bool, &bool)) {		 fprintf(stderr, "can't reply to RPC call\en");		 return (1);	}	return;}.DE.KE.LPThe relevant routine is.I svc_getargs()which takes an.I SVCXPRThandle, the XDR routine,and a pointer to where the input is to be placed as arguments..NH 2\&Memory Allocation with XDR.IX "memory allocation with XDR".IX XDR "memory allocation".LPXDR routines not only do input and output,they also do memory allocation.This is why the second parameter of.I xdr_array()is a pointer to an array, rather than the array itself.If it is.I NULL ,then.I xdr_array()allocates space for the array and returns a pointer to it,putting the size of the array in the third argument.As an example, consider the following XDR routine.I xdr_chararr1()which deals with a fixed array of bytes with length.I SIZE ..ie t .DS.el .DS L.ft CWxdr_chararr1(xdrsp, chararr)	XDR *xdrsp;	char chararr[];{	char *p;	int len;	p = chararr;	len = SIZE;	return (xdr_bytes(xdrsp, &p, &len, SIZE));}.DEIf space has already been allocated in.I chararr ,it can be called from a server like this:.ie t .DS.el .DS L.ft CWchar chararr[SIZE];svc_getargs(transp, xdr_chararr1, chararr);.DEIf you want XDR to do the allocation,you would have to rewrite this routine in the following way:.ie t .DS.el .DS L.ft CWxdr_chararr2(xdrsp, chararrp)	XDR *xdrsp;	char **chararrp;{	int len;	len = SIZE;	return (xdr_bytes(xdrsp, charrarrp, &len, SIZE));}.DEThen the RPC call might look like this:.ie t .DS.el .DS L.ft CWchar *arrptr;arrptr = NULL;svc_getargs(transp, xdr_chararr2, &arrptr);.ft I/* * Use the result here */.ft CWsvc_freeargs(transp, xdr_chararr2, &arrptr);.DENote that, after being used, the character array can be freed with.I svc_freeargs().I svc_freeargs() will not attempt to free any memory if the variable indicating it is NULL.  For example, in the the routine .I xdr_finalexample (),given earlier, if.I finalp->string was NULL, then it would not be freed.  The same is true for .I finalp->simplep ..LPTo summarize, each XDR routine is responsiblefor serializing, deserializing, and freeing memory.When an XDR routine is called from.I callrpc()the serializing part is used.When called from.I svc_getargs()the deserializer is used.And when called from.I svc_freeargs()the memory deallocator is used.  When building simple examples like thosein this section, a user doesn't have to worry about the three modes.  See the.I "External Data Representation: Sun Technical Notes"for examples of more sophisticated XDR routines that determine which of the three modes they are in and adjust their behavior accordingly..KS.NH 2\&The Calling Side.IX RPC "calling side".LPWhen you use.I callrpc()you have no control over the RPC deliverymechanism or the socket used to transport the data.To illustrate the layer of RPC that lets you adjust theseparameters, consider the following code to call the.I nusersservice:.ie t .DS.el .DS L.ft CW.vs 11#include <stdio.h>#include <rpc/rpc.h>#include <utmp.h>#include <rpcsvc/rusers.h>#include <sys/socket.h>#include <sys/time.h>#include <netdb.h>main(argc, argv)	int argc;	char **argv;{	struct hostent *hp;	struct timeval pertry_timeout, total_timeout;	struct sockaddr_in server_addr;	int sock = RPC_ANYSOCK;	register CLIENT *client;	enum clnt_stat clnt_stat;	unsigned long nusers;	if (argc != 2) {		fprintf(stderr, "usage: nusers hostname\en");		exit(-1);	}	if ((hp = gethostbyname(argv[1])) == NULL) {		fprintf(stderr, "can't get addr for %s\en",argv[1]);		exit(-1);	}	pertry_timeout.tv_sec = 3;	pertry_timeout.tv_usec = 0;	bcopy(hp->h_addr, (caddr_t)&server_addr.sin_addr,		hp->h_length);	server_addr.sin_family = AF_INET;	server_addr.sin_port =  0;	if ((client = clntudp_create(&server_addr, RUSERSPROG,	  RUSERSVERS, pertry_timeout, &sock)) == NULL) {		clnt_pcreateerror("clntudp_create");		exit(-1);	}	total_timeout.tv_sec = 20;	total_timeout.tv_usec = 0;	clnt_stat = clnt_call(client, RUSERSPROC_NUM, xdr_void,		0, xdr_u_long, &nusers, total_timeout);	if (clnt_stat != RPC_SUCCESS) {		clnt_perror(client, "rpc");		exit(-1);	}	clnt_destroy(client);	close(sock);	exit(0);}.vs.DE.KEThe low-level version of.I callrpc()is.I clnt_call()which takes a.I CLIENTpointer rather than a host name.  The parameters to.I clnt_call() are a.I CLIENT pointer, the procedure number,the XDR routine for serializing the argument,a pointer to the argument,the XDR routine for deserializing the return value,a pointer to where the return value will be placed,and the time in seconds to wait for a reply..LPThe.I CLIENT pointer is encoded with the transport mechanism..I callrpc()uses UDP, thus it calls.I clntudp_create() to get a.I CLIENT pointer.  To get TCP (Transmission Control Protocol), you would use.I clnttcp_create() ..LPThe parameters to.I clntudp_create() are the server address, the program number, the version number,a timeout value (between tries), and a pointer to a socket.The final argument to.I clnt_call() is the total time to wait for a response.Thus, the number of tries is the.I clnt_call() timeout divided by the.I clntudp_create() timeout..LPNote that the.I clnt_destroy()callalways deallocates the space associated with the.I CLIENT handle.  It closes the socket associated with the.I CLIENT handle, however, only if the RPC library opened it.  It thesocket was opened by the user, it stays open.  This makes itpossible, in cases where there are multiple client handlesusing the same socket, to destroy one handle without closingthe socket that other handles are using..LPTo make a stream connection, the call to.I clntudp_create() is replaced with a call to.I clnttcp_create() ..DS.ft CWclnttcp_create(&server_addr, prognum, versnum, &sock,               inputsize, outputsize);.DEThere is no timeout argument; instead, the receive and send buffersizes must be specified.  When the.I clnttcp_create() call is made, a TCP connection is established.All RPC calls using that.I CLIENT handle would use this connection.The server side of an RPC call using TCP has.I svcudp_create()replaced by.I svctcp_create() ..DS.ft CWtransp = svctcp_create(RPC_ANYSOCK, 0, 0);.DEThe last two arguments to .I svctcp_create() are send and receive sizes respectively.  If `0' is specified for either of these, the system chooses a reasonable default..KS.NH 1\&Other RPC Features.IX "RPC" "miscellaneous features".IX "miscellaneous RPC features".LPThis section discusses some other aspects of RPCthat are occasionally useful..NH 2\&Select on the Server Side.IX RPC select() RPC \fIselect()\fP.IX select() "" \fIselect()\fP "on the server side".LPSuppose a process is processing RPC requestswhile performing some other activity.If the other activity involves periodically updating a data structure,the process can set an alarm signal before calling.I svc_run()But if the other activityinvolves waiting on a a file descriptor, the.I svc_run()call won't work.The code for.I svc_run()is as follows:.ie t .DS.el .DS L.ft CW.vs 11voidsvc_run(){	fd_set readfds;	int dtbsz = getdtablesize();	for (;;) {		readfds = svc_fds;		switch (select(dtbsz, &readfds, NULL,NULL,NULL)) {		case -1:			if (errno == EINTR)				continue;			perror("select");			return;		case 0:			break;		default:			svc_getreqset(&readfds);		}	}}.vs.DE.KE.LPYou can bypass.I svc_run()and call.I svc_getreqset()yourself.All you need to know are the file descriptorsof the socket(s) associated with the programs you are waiting on.Thus you can have your own.I select() .IX select() "" \fIselect()\fPthat waits on both the RPC socket,and your own descriptors.  Note that.I svc_fds() is a bit mask of all the file descriptors that RPC is using for services.  It can change everytime that.I anyRPC library routine is called, because descriptors are constantly being opened and closed, for example for TCP connections..NH 2\&Broadcast RPC.IX "broadcast RPC".IX RPC "broadcast".LPThe.I portmapperis a daemon that converts RPC program numbersinto DARPA protocol port numbers; see the.I portmap man page.  You can't do broadcast RPC without the portmapper.Here are the main differences betweenbroadcast RPC and normal RPC calls:.IP  1.Normal RPC expects one answer, whereasbroadcast RPC expects many answers(one or more answer from each responding machine)..IP  2.Broadcast RPC can only be supported by packet-oriented (connectionless)transport protocols like UPD/IP..IP  3.The implementation of broadcast RPCtreats all unsuccessful responses as garbage by filtering them out.Thus, if there is a version mismatch between thebroadcaster and a remote service,the user of broadcast RPC never knows..IP  4.All broadcast messages are sent to the portmap port.Thus, only services that register themselves with their portmapperare accessible via the broadcast RPC mechanism..IP  5.Broadcast requests are limited in size to the MTU (Maximum TransferUnit) of the local network.  For Ethernet, the MTU is 1500 bytes..KS.NH 3\&Broadcast RPC Synopsis.IX "broadcast RPC" synopsis.IX "RPC" "broadcast synopsis".ie t .DS.el .DS L.ft CW#include <rpc/pmap_clnt.h>	. . .enum clnt_stat	clnt_stat;	. . .clnt_stat = clnt_broadcast(prognum, versnum, procnum,  inproc, in, outproc, out, eachresult)	u_long    prognum;        /* \fIprogram number\fP */	u_long    versnum;        /* \fIversion number\fP */	u_long    procnum;        /* \fIprocedure number\fP */	xdrproc_t inproc;         /* \fIxdr routine for args\fP */	caddr_t   in;             /* \fIpointer to args\fP */	xdrproc_t outproc;        /* \fIxdr routine for results\fP */	caddr_t   out;            /* \fIpointer to results\fP */	bool_t    (*eachresult)();/* \fIcall with each result gotten\fP */.DE.KEThe procedure.I eachresult()is called each time a valid result is obtained.It returns a boolean that indicateswhether or not the user wants more responses..ie t .DS.el .DS L.ft CWbool_t done;	. . . done = eachresult(resultsp, raddr)	caddr_t resultsp;	struct sockaddr_in *raddr; /* \fIAddr of responding machine\fP */.DEIf.I doneis.I TRUE ,then broadcasting stops and.I clnt_broadcast()returns successfully.Otherwise, the routine waits for another response.The request is rebroadcastafter a few seconds of waiting.If no responses come back,the routine returns with.I RPC_TIMEDOUT ..NH 2\&Batching.IX "batching".IX RPC "batching".LPThe RPC architecture is designed so that clients send a call message,and wait for servers to reply that the call succeeded.This implies that clients do not computewhile servers are processing a call.This is inefficient if the client does not want or needan acknowledgement for every message sent.It is possible for clients to continue computingwhile waiting for a response,using RPC batch facilities..LPRPC messages can be placed in a \*Qpipeline\*U of callsto a desired server; this is called batching.Batching assumes that:1) each RPC call in the pipeline requires no response from the server,and the server does not send a response message; and2) the pipeline of calls is transported on a reliablebyte stream transport such as TCP/IP.Since the server does not respond to every call,the client can generate new calls in parallelwith the server executing previous calls.Furthermore, the TCP/IP implementation can buffer upmany call messages, and send them to the server in one.I write()system call.  This overlapped executiongreatly decreases the interprocess communication overhead ofthe client and server processes,and the total elapsed time of a series of calls..LPSince the batched calls are buffered,the client should eventually do a nonbatched callin order to flush the pipeline..LPA contrived example of batching follows.Assume a string rendering service (like a window system)has two similar calls: one renders a string and returns void results,while the other renders a string and remains silent.The service (using the TCP/IP transport) may look like:.ie t .DS.el .DS L.ft CW#include <stdio.h>#include <rpc/rpc.h>#include <suntool/windows.h>void windowdispatch();main(){	SVCXPRT *transp;	transp = svctcp_create(RPC_ANYSOCK, 0, 0);	if (transp == NULL){		fprintf(stderr, "can't create an RPC server\en");		exit(1);	}	pmap_unset(WINDOWPROG, WINDOWVERS);	if (!svc_register(transp, WINDOWPROG, WINDOWVERS,	  windowdispatch, IPPROTO_TCP)) {		fprintf(stderr, "can't register WINDOW service\en");		exit(1);	}	svc_run();  /* \fINever returns\fP */	fprintf(stderr, "should never reach this point\en");}voidwindowdispatch(rqstp, transp)	struct svc_req *rqstp;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美国产激情二区三区| 91国产免费看| 精品国产乱码久久久久久蜜臀| 亚洲综合一区二区| 91在线一区二区| 国产欧美一区二区三区沐欲| 国产一区二区精品久久| 26uuuu精品一区二区| 国精品**一区二区三区在线蜜桃| 精品国产伦一区二区三区观看体验| 日韩中文字幕亚洲一区二区va在线 | 久久久久久久免费视频了| 麻豆成人久久精品二区三区红| 日韩一区二区在线播放| 久久成人免费电影| 国产日韩欧美精品在线| 波多野结衣欧美| 亚洲人成网站影音先锋播放| 色视频欧美一区二区三区| 《视频一区视频二区| 一本一道久久a久久精品| 亚洲综合色区另类av| 欧美日韩国产中文| 久久99精品视频| 久久精品一区二区三区av| 捆绑变态av一区二区三区| 日韩免费福利电影在线观看| 激情国产一区二区| 欧美国产日韩一二三区| 91毛片在线观看| 偷拍亚洲欧洲综合| 久久久噜噜噜久久人人看| 懂色av一区二区夜夜嗨| 亚洲日本电影在线| 51精品视频一区二区三区| 日本欧美一区二区三区乱码| 欧美mv和日韩mv的网站| 高清视频一区二区| 亚洲尤物视频在线| 日韩亚洲欧美成人一区| 久久国产综合精品| 国产精品久久久久久久久免费桃花| 91免费观看视频在线| 日韩国产成人精品| 日韩精品在线一区| 91在线免费播放| 日本大胆欧美人术艺术动态| 久久精品欧美一区二区三区不卡 | 欧美日本在线一区| 国产在线精品一区在线观看麻豆| 国产精品毛片久久久久久| 欧美日韩视频第一区| 精品无人码麻豆乱码1区2区 | 精品久久久久av影院| 99国产精品久久久久久久久久| 五月天激情综合| 日韩一级欧美一级| 91首页免费视频| 久久精品国产秦先生| 亚洲福利一区二区三区| 欧美国产1区2区| 制服丝袜国产精品| 风间由美一区二区av101| 视频一区二区中文字幕| 亚洲人成影院在线观看| 欧美精品一区二区三区在线播放| 欧美亚洲动漫精品| 国产精品亚洲а∨天堂免在线| 亚洲精品国产品国语在线app| 精品国产乱码久久久久久蜜臀| 欧洲av在线精品| 99在线视频精品| 日本 国产 欧美色综合| 亚洲午夜一区二区| 亚洲免费在线看| 久久一夜天堂av一区二区三区| 欧美日韩国产123区| 在线一区二区三区四区| 99精品视频一区| 国产成人精品三级麻豆| 精品一区二区三区免费| 青椒成人免费视频| 日本不卡视频在线观看| 午夜成人免费视频| 亚洲天堂av一区| 欧美国产日韩在线观看| 久久精品网站免费观看| 精品国产a毛片| 日韩限制级电影在线观看| 欧美日韩精品一区二区天天拍小说| 国产乱理伦片在线观看夜一区| 免费成人美女在线观看.| 一区二区成人在线视频| 国产精品美女久久久久高潮| 日本一区二区高清| 欧美国产日韩一二三区| 国产色产综合色产在线视频| 久久久精品中文字幕麻豆发布| xnxx国产精品| 国产日韩欧美激情| 国产精品久久久久久久岛一牛影视 | 成人夜色视频网站在线观看| fc2成人免费人成在线观看播放| 91极品视觉盛宴| 91精品国产一区二区| 久久久久88色偷偷免费| 亚洲欧美日本韩国| 麻豆91免费看| av不卡在线观看| 欧美日韩视频在线第一区| 久久久蜜臀国产一区二区| 亚洲日本韩国一区| 开心九九激情九九欧美日韩精美视频电影 | 亚洲成人免费视| 国产综合久久久久久鬼色| 色哟哟一区二区三区| 91精品国产综合久久久蜜臀图片| 国产三级精品视频| 亚洲成人1区2区| 国产suv精品一区二区883| 欧美特级限制片免费在线观看| 精品国产免费人成电影在线观看四季| 国产精品久久久久影视| 免费不卡在线视频| 一本大道综合伊人精品热热| 日韩欧美在线影院| 亚洲一区二三区| 国产suv一区二区三区88区| 欧美剧在线免费观看网站| 国产精品视频一二三区| 日本在线播放一区二区三区| 91麻豆免费看| 久久精品欧美一区二区三区麻豆| 亚洲国产欧美日韩另类综合| 国产成人免费网站| 91麻豆精品国产91久久久资源速度 | 精品亚洲aⅴ乱码一区二区三区| 色网综合在线观看| 欧美激情一区在线观看| 美女视频黄免费的久久| 欧美主播一区二区三区| 国产精品拍天天在线| 蜜桃视频在线观看一区二区| 欧美在线视频全部完| 国产欧美视频一区二区三区| 美国三级日本三级久久99| 欧美日韩中文国产| 亚洲欧美偷拍三级| 国产成人福利片| 欧美大片在线观看| 麻豆精品视频在线观看免费| 欧美揉bbbbb揉bbbbb| 中文字幕亚洲在| www.欧美日韩| 国产日韩欧美综合在线| 国内精品免费在线观看| 日韩一区二区三区免费看| 亚洲风情在线资源站| 欧美艳星brazzers| 亚洲在线成人精品| 欧美体内she精高潮| 亚洲国产一区二区三区| 91精品福利视频| 亚洲天堂免费看| caoporn国产精品| 一区视频在线播放| 91捆绑美女网站| 亚洲免费av高清| 色婷婷激情综合| 亚洲午夜免费电影| 欧美日韩国产乱码电影| 亚洲成精国产精品女| 欧美一级日韩一级| 蜜桃精品在线观看| 欧美va亚洲va香蕉在线| 国产一区二区三区高清播放| 久久婷婷一区二区三区| 懂色av一区二区三区蜜臀| 国产精品久久久久久户外露出 | 99精品热视频| 亚洲男人的天堂在线观看| 色噜噜夜夜夜综合网| 亚洲影院免费观看| 欧美日韩一区二区不卡| 日本va欧美va瓶| 久久久综合激的五月天| www.久久精品| 亚洲sss视频在线视频| 欧美福利一区二区| 国产一区欧美二区| 中文字幕一区日韩精品欧美| 欧美性大战久久久久久久蜜臀| 午夜久久久久久久久| 26uuu国产电影一区二区| 精品久久久久久综合日本欧美| 国产三级欧美三级| www久久久久| 首页综合国产亚洲丝袜| 97超碰欧美中文字幕| 亚洲一二三区在线观看|