A apresentação está carregando. Por favor, espere

A apresentação está carregando. Por favor, espere

Invocação Remota de Procedimentos (RPC) Alexandre Bragança 2001 DEI / ISEP.

Apresentações semelhantes


Apresentação em tema: "Invocação Remota de Procedimentos (RPC) Alexandre Bragança 2001 DEI / ISEP."— Transcrição da apresentação:

1 Invocação Remota de Procedimentos (RPC) Alexandre Bragança 2001 DEI / ISEP

2 Modelo de Programação

3 Cliente-Servidor

4 Funcionamento

5 OSF DCE n DCE = Distributed Computing Environment n OSF = Open Software Foundation

6 Exemplo Hello World /* file hellop.c */ #include #include void HelloProc(unsigned char * pszString) { printf(%s\n, pszString); } /* file: hello.c, a stand-alone application */ #include hellop.c void main(void) { unsigned Char * pszString = Hello, World; HelloProc(pszString); }

7 Definição do Interface //file hello.idl [uuid(7a98c250-6808-11cf-b73b-00aa00b677a7),version(1.0)] interface hello { void HelloProc([in, string] unsigned char * pszString); void Shutdown(void); } A função Shutdown permite que o cliente desligue o servidor A função Shutdown permite que o cliente desligue o servidor

8 Geração dos Stubs Midl hello.idl Hello.h A incluir no cliente e no servidor hello_c.c Stub Cliente hello_s.c Stub Servidor

9 Implementação do código do Servidor #include #include "hello.h" // header file generated by MIDL compiler void HelloProc(unsigned char * pszString) { printf("%s\n", pszString); } void Shutdown(void) { RPC_STATUS status; printf("Calling RpcMgmtStopServerListening\n"); status = RpcMgmtStopServerListening(NULL); printf("RpcMgmtStopServerListening returned: 0x%x\n", status); if (status) { exit(status); } printf("Calling RpcServerUnregisterIf\n"); status = RpcServerUnregisterIf(NULL, NULL, FALSE); printf("RpcServerUnregisterIf returned 0x%x\n", status); if (status) { exit(status); }

10 Compilação & Execução Compilação Cliente: helloc.exe helloc.c - Código do cliente hello_c.c – Stub Servidor: hellos.exe hellos.c – Código do servidor hellop.c – Implementação dos serviços hello_s.c – Stub do servidor Execução No servidor: hellos No cliente: helloc


Carregar ppt "Invocação Remota de Procedimentos (RPC) Alexandre Bragança 2001 DEI / ISEP."

Apresentações semelhantes


Anúncios Google