Java RPC
What is RPC?
Remote Procedure Call or RPC is a protocol used by a program in order to request a service from another program which could be located in another a computer or network. The program does not have to understand the network’s details when using RPC. A procedure call is also known as function call or subroutine call.
How does RPC work?
When a remote call is made, the calling environment or client environment is suspended. The parameters of the procedure are transferred across to the environment in which the procedure is to be executed. The procedure is then executed in that environment.
Once the procedure is completed, the results are sent back to the calling environment.
Types of RPC
5 types of RPC can be identified
- The client makes a call and does not continue until the server sends a reply
- The client makes the call but server does not reply. Client continues with its own processing
- A facility for sending several client nonblocking calls in one batch
- Client sending messages to many servers and then receive all the results as replies
- Client making a server call and serve signals that the call is completed by calling a procedure associated with the client
Now let’s look at an RPC style example using Hello World
3 files should be created for server side :
1 application should be created for the client side :