2.14.6. Rehearsal

At this point, you should understand how remote procedure calls work both in procedure oriented and in object oriented environments. You should be able to list the steps taken to generate and instantiate the client and server stubs and to execute a remote procedure call.

You should be able to tell what information is required for generating the client and server stubs and explain where this information comes from. You should be able to tell how specific types of arguments are marshalled and explain how marshalling can influence the argument passing semantics.

Based on your knowledge of how remote procedure calls are used, you should be able to design an API suitable for a specific application scenario, and to explain how your choice of the various API properties fits the scenario.

Questions. 

  1. When invoking a procedure that passes an argument by value, RPC middleware has to handle situations where binary representation of the values differs between the client and the server. Outline and discuss the approaches used to do this.

  2. When invoking a procedure that passes an argument by reference, RPC middleware has to handle situations where the reference has no meaning outside the address space of the client or the server. Outline and discuss the approaches used to do this.

  3. Napište kód stubu na straně klienta a na straně serveru tak, aby zprostředkoval vzdálené volání funkce int read (int iFile, void *pBuffer, int iSize), která prečte data z otevřeného souboru. Váš návrh by měl používat tyto funkce:

    void ReliableSend (tMsg *pMessage, tAddr *pTarget);
      // Odeslání zprávy, blokuje do přijetí zprávy
    
    void ReliableReceive (tMsg &*pMessage, tAddr &*pSource);
      // Příjem zprávy, blokuje do přijetí zprávy, zaručuje
      // právě jeden příjem nepoškozené odeslané zprávy
    

    Dále předpokládejte existenci rozumných funkcí pro manipulaci se zprávami jako je jejich vytváření a rušení, přístup k obsahu zprávy a podobně.