final flashcards
RPC Compiler (rpcgen):
This is a crucial tool within the Sun RPC package. It automates the generation of client and server stubs, saving developers significant time and effort.
Sun RPC, understand the general mechanism for creating client and
server stub routines using rpcgen
Sun RPC (Remote Procedure Call) is a mechanism that allows programs to call procedures in other address spaces remotely. It enables distributed computing by allowing a program to execute code on another machine as if it were local.
RPC uses a client-server model where the client program calls procedures located on a remote server.
The RPC compiler, rpcgen, automatically generates client and server stub routines from a specification file (.x file) that describes the remote procedures, their parameters, and their return types.
The generated client and server stubs handle the marshalling (serialization) and unmarshalling (deserialization) of parameters and results, as well as the communication over the network.
what is XDR
(eXternal Data Representation):
XDR is a standard for serializing data for transmission between different computer architectures. It provides a platform-independent way to represent data structures.
Sun RPC uses XDR for encoding data passed between client and server stubs. XDR supports basic data types such as integers, floats, and strings, as well as user-defined structures.
When you define remote procedures in an .x file, you specify the data types of their parameters and return values using XDR data types.
Know generally how parameters are passed and results are returned.
Sun RPC allows remote procedures to have a single parameter and a single return value. If you need to pass multiple parameters or return multiple values, you can use structures.
Parameters are marshalled into a format suitable for transmission over the network by the client stub before being sent to the server.
The server stub unmarshals the parameters, executes the procedure, marshals the return value, and sends it back to the client.
Extra care must be taken when dealing with pointers or complex data structures to ensure that they are properly serialized and deserialized.
Know how the port mapper daemon process is used.
The port mapper daemon (rpcbind or portmap) is a system service that maps program numbers to network ports.
When a server program starts, it registers its program number and version with the port mapper on the local machine.
When a client program wants to call a remote procedure, it contacts the port mapper on the server’s machine to obtain the port number associated with the server’s program number and version.
This allows the client to connect to the correct port on the server to make the remote procedure call.
Understand how the use of UDP and TCP affects the Sun RPC mechanism.
Sun RPC supports both UDP (User Datagram Protocol) and TCP (Transmission Control Protocol) for communication between client and server.
UDP is connectionless and provides fast, lightweight communication suitable for stateless protocols. It is the default choice for Sun RPC.
TCP is connection-oriented and provides reliable, ordered communication suitable for protocols that require guaranteed delivery of data.
When creating the client handle, you can specify whether to use UDP or TCP for communication. This choice affects how the client communicates with the server.
XDR (eXternal Data Representation):
Sun RPC utilizes XDR to represent the data exchanged between client and server stubs. XDR ensures that data can be transferred seamlessly across different architectures, which is vital in distributed computing environments.
Built-in Representation for Basic Types:
Sun RPC offers built-in support for fundamental data types like integers (int), floating-point numbers (float), and characters (char). This simplifies the handling of common data types in distributed applications.
Declarative Language for Complex Data Types
In addition to basic types, Sun RPC provides a declarative language for specifying complex data structures. This allows developers to define custom data types and their serialization/deserialization processes, enabling efficient communication between distributed components.
Parameter Passing
Sun RPC, parameter passing refers to how arguments are transmitted from the client to the server and how results are returned. Sun RPC allows only a single argument to be passed and received per procedure call. If multiple parameters are needed, they must be grouped into a structure. This restriction simplifies the communication protocol and ensures interoperability across different platforms.
Binding:
Binding in Sun RPC is the process of establishing a connection between the client and server. This is done through the port mapper daemon process, which maps remote procedure call (RPC) program numbers to network addresses. The client needs to know the name of the remote server to initiate the binding process and communicate with the appropriate RPC service.
Transport Protocol:
Sun RPC supports two transport protocols: User Datagram Protocol (UDP) and Transmission Control Protocol (TCP). UDP is connectionless and provides a lightweight, unreliable communication mechanism suitable for applications where speed is prioritized over reliability. TCP, on the other hand, offers reliable, connection-oriented communication, ensuring that data is delivered correctly and in order. The choice of transport protocol depends on factors such as the reliability requirements and network conditions of the application.
Exception Handling:
Exception handling in Sun RPC depends on the transport protocol being used. In UDP, if the client does not receive a response from the server within a certain timeout period, it resends the request. This mechanism helps mitigate packet loss and network congestion. However, in TCP, if an error occurs during communication, such as a network failure or server crash, the client does not resend the request. Instead, it handles the error locally or informs the user accordingly.
Data Representation
Sun RPC uses eXternal Data Representation (XDR) to encode and decode data transmitted between the client and server. XDR provides a standardized format for representing data types, ensuring compatibility across different architectures and programming languages. It defines a set of rules for encoding basic data types, such as integers and strings, as well as structures and arrays. This enables seamless communication between heterogeneous systems in distributed computing environments
Remote Procedure Call (RPC)
A mechanism that allows a program to execute code on another remote machine as if it were a local procedure call.
rpcgen:
A tool used to generate client and server stub routines for RPC programming.
Client Stub
A client-side proxy for a remote procedure, responsible for marshalling parameters, making the RPC call, and unmarshalling results.
Server Stub
A server-side proxy for a remote procedure, responsible for receiving RPC requests, unmarshalling parameters, invoking the actual procedure, and marshalling results.
XDR (External Data Representation)
XDR (External Data Representation)
A standard for encoding and decoding data structures in a platform-independent format, used for data serialization in RPC.
TCP (Transmission Control Protocol):
A connection-oriented transport protocol that ensures reliable and ordered delivery of data.
UDP (User Datagram Protocol)
A connectionless transport protocol that provides fast but unreliable communication.
Port Mapper Daemon
Port Mapper Daemon
A process responsible for mapping RPC program numbers to network addresses, facilitating communication between clients and servers.
Authentication
Authentication
The process of verifying the identity of clients and servers in an RPC communication, ensuring secure interactions.
AUTH_NULL:
An authentication mechanism in Sun RPC that provides no authentication
AUTH_SYS
An authentication mechanism in Sun RPC that uses Unix credentials for authentication.
AUTH_DES
An authentication mechanism in Sun RPC that employs the Data Encryption Standard (DES) for secure communication.
Structure
A composite data type in C that allows the bundling of multiple variables under a single name.
Timeout
A predetermined period within which a client expects to receive a response from the server.
Error Handling
The process of detecting and responding to errors that occur during RPC communication, ensuring robustness and reliability.
Result Returning
In RPC, it’s when the server sends back the outcome of the requested procedure to the client, which could be a value, object, or indication of success/failure. It ensures the client receives the executed procedure’s outcome for further actions.
Java RMI
Java Remote Method Invocation (RMI) is a mechanism in Java that allows objects to invoke methods remotely, facilitating distributed computing.
Remote Object Interface
This is an interface in Java RMI that extends java.rmi.Remote and declares methods that can be invoked remotely. Methods in this interface must throw RemoteException.
Server Side Code
This is the implementation of the remote object in Java RMI. It extends UnicastRemoteObject and implements the remote object interface. It provides the actual functionality of the remote object’s methods.
Client-Side Code
This is the client program in Java RMI that interacts with the remote object. It can perform operations like sending messages to the remote object or invoking its methods.
Remote Object Requirements
Specifies the requirements for creating a remote object in Java RMI, including extending java.rmi.Remote, declaring methods to throw RemoteException, and registering the object using java.rmi.Naming.
Client Requirements
Specifies the requirements for the client program in Java RMI, including initializing the RMI security manager and using java.rmi.Naming to retrieve a reference to the remote object.
Remote Object Requirements
Interface extends java.rmi.Remote.
Interface methods throw java.rmi.RemoteException.
Interface is public.
Interface may extend java.rmi.server.UnicastRemoteObject.
All methods must declare throws RemoteException.
Object registered using java.rmi.Naming.rebind().
Object’s interface and implementation compiled into bytecode.
Client and server stubs generated using rmic.
RMI registry must be running on the server.
Launched with rmiregistry [PORT NUMBER].
How to Run a Java RMI
Specify Server: You need to tell the client which server to connect to by specifying it in the command line.
Organize Files: Make sure all necessary files are in the same directory on the server, and use the ‘make’ command to compile them.
Repeat for Client: If the client will run on a different machine, repeat the file organization step on the client machine.
Launch RMI Registry: Start the RMI registry on the server machine using the command ‘rmiregistry &’. Remember to stop it when finished.
Launch Remote Object: Run the remote object on the server using the command ‘java RMIExampleImpl’.
Launch Client: Run the client application, either on the same machine or a remote one, using the command ‘java -Djava.security.policy=java.policy RMIClient -m “A Message to send”’. You can see the available options and their descriptions in the RMIClient.java file.
Request/Reply Patterns
gRPC supports four types of patterns:
Simple RPC
Server Streaming RPC
Client Streaming RPC
Bidirectional Streaming RPC
gRPC
A remote procedure call framework developed collaboratively by Google and Square, built upon HTTP/2, TLS, and TCP. It encodes remote method identifiers as URIs, request parameters in HTTP messages, and return values in HTTP responses.
Protocol Buffers with RPC
gRPC utilizes Google’s Protocol Buffer (protobuf) mechanism for defining interfaces and serializing data. Protocol buffer data is structured as messages with name-value pairs called fields, stored in a .proto file