What is marshalling in RPC?

Remote Procedure Call (RPC) is a client-server mechanism that enables an application on one machine to make a procedure call to code on another machine. The client calls a local procedure—a stub routine—that packs its arguments into a message and sends them across the network to a particular server process. The client-side stub routine then blocks. Meanwhile, the server unpacks the message, calls the procedure, packs the return results into a message, and sends them back to the client stub. The client stub unblocks, receives the message, unpacks the results of the RPC, and returns them to the caller. This packing of arguments is sometimes called marshaling.

Marshalling involves the following actions −

  • First the argument of client process or the result of a server process is taken which will form the message data to be sent to remote process.

  • Encode the message data of step 1 on the sender’s computer. The conversion of program objects into a stream form that is suitable for transmission will be involved by this encoding process.