1 / 10

Module 9 – RPC Programming

Module 9 – RPC Programming. Objectives. RPC Library Interface 에 대해 이해 한다 . High level RPC(Remote Procedure Call) 프로그래밍 기법에 대해 이해한다 . High level RPC 관련 응용 프로그램을 작성한다. High-level & Low-level calls. callrpc() clnt_create() clnttcp_create() clntudp_create() clntraw_create()

luella
Download Presentation

Module 9 – RPC Programming

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Module 9 – RPC Programming

  2. Objectives • RPC Library Interface 에 대해 이해 한다. • High level RPC(Remote Procedure Call) 프로그래밍 기법에 대해 이해한다. • High level RPC 관련 응용 프로그램을 작성한다.

  3. High-level & Low-level calls callrpc() clnt_create() clnttcp_create() clntudp_create() clntraw_create() clnt_destroy() clnt_call() clnt_control() clnt_freeres() high-level calls registerrpc() svc_run() svctcp_create() svcudp_create() svcraw_create() svc_destroy() svc_register() svc_unregister() svc_getargs() svc_sendreply() svc_getreset() Network low-level calls transport library transport library

  4. High-level RPC • high-level function을 이용 • UDP transport protocol 사용 • client & server의 interface를 직접 구현 • Client : server의 함수 호출 • Server : service 함수를 등록 • protocol compiler를 사용하지 않고 프로그램 가능 • TCP를 사용하기 위해서는 low-level function을 사용

  5. High-level RPC Operation Server Machine Server Program service pocedures registerrpc() rpcbind svc_run() dispatch function callrpc() host, program, version, procedure, arguments error or results Client Program Client Machine

  6. High-level functions – server side • registerpc() #include <rpc/rpc.h> int registerrpc(prognum, versnum, procnum, procname, inproc, outproc) u_long          prognum, versnum, procnum; char            *(*procname)(); xdrproc_t       inproc, outproc; • svc_run() #include <rpc/rpc.h> void svc_run()

  7. High-level functions – client side • callrpc() #include <rpc/rpc.h> int callrpc (host, prognum, versnum, procnum, inproc, in, outproc, out) char  *host; u_long       prognum, versnum, procnum; char         *in, *out; xdrproc_t    inproc, outproc; • clnt_sperrno() #include <rpc/rpc.h> char *clnt_sperrno(stat) enum clnt_stat  stat;

  8. rls.c Client rls.h rls_xdr.c rls_svc.c read_dir.c Server Example Program

  9. rls.h #define DIR_SIZE 8192 /* server program (suite) number */ #define DIRPROG ((u_long) 0x20000001) /* program version number */ #define DIRVERS ((u_long) 1) /* procedure number for look-up */ #define READDIR ((u_long) 1)

  10. rls_xdr.c #include <rpc/rpc.h> #include "rls.h" bool_t xdr_dir(xdrs, objp) XDR *xdrs; char *objp; { return ( xdr_string(xdrs, &objp, DIR_SIZE) ); }

More Related