Invocação Remota de Procedimentos (RPC)
Upcoming SlideShare
Loading in...5
×
 

Invocação Remota de Procedimentos (RPC)

on

  • 1,515 views

 

Statistics

Views

Total Views
1,515
Views on SlideShare
1,509
Embed Views
6

Actions

Likes
0
Downloads
7
Comments
0

2 Embeds 6

http://www.slideshare.net 5
http://www.slideee.com 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Invocação Remota de Procedimentos (RPC) Invocação Remota de Procedimentos (RPC) Presentation Transcript

  • Invocação Remota de Procedimentos (RPC) Alexandre Bragança 2001 DEI / ISEP
  • Modelo de Programação
  • Cliente-Servidor
  • Funcionamento
  • OSF DCE
    • DCE = Distributed Computing Environment
    • OSF = Open Software Foundation
  • Exemplo Hello World /* file hellop.c */ #include <stdio.h> void HelloProc(unsigned char * pszString) { printf(“%s ”, pszString); } /* file: hello.c, a stand-alone application */ #include “hellop.c” void main(void) { unsigned Char * pszString = “Hello, World”; HelloProc(pszString); }
  • 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
  • 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
  • Implementação do código do Servidor #include <stdlib.h> #include <stdio.h> #include &quot;hello.h&quot; // header file generated by MIDL compiler void HelloProc(unsigned char * pszString) { printf(&quot;%s &quot;, pszString); } void Shutdown(void) { RPC_STATUS status; printf(&quot;Calling RpcMgmtStopServerListening &quot;); status = RpcMgmtStopServerListening(NULL); printf(&quot;RpcMgmtStopServerListening returned: 0x%x &quot;, status); if (status) { exit(status); } printf(&quot;Calling RpcServerUnregisterIf &quot;); status = RpcServerUnregisterIf(NULL, NULL, FALSE); printf(&quot;RpcServerUnregisterIf returned 0x%x &quot;, status); if (status) { exit(status); } }
  • 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