Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between Socket and RPC?

What is the actual difference between Socket and RPC (Remote Procedure Call)?

As per my understanding both's working is based on Client–server model. Also which one should be used in which conditions?

PS: Confusion arise while reading Operating System Concepts by Galvin

like image 750
roottraveller Avatar asked Sep 09 '17 08:09

roottraveller


People also ask

What is the advantage of RPC over socket programming?

The major benefits of RPC are twofold: the programmer can now use procedure call semantics and writing distributed applications is simplified because RPC hides all of the network code into stub functions. Also, application programs don't have to worry about details (such as sockets, port numbers, byte ordering).

What is the difference between RPC and HTTP?

RPC is action-oriented. Supports HTTP methods GET, POST, PUT, PATCH, and DELETE. RPC only supports GET and POST requests.

What is a RPC system?

gRPC is a modern open source high performance Remote Procedure Call (RPC) framework that can run in any environment. It can efficiently connect services in and across data centers with pluggable support for load balancing, tracing, health checking and authentication.

Is RPC TCP or UDP?

Generally, RPC applications will use UDP when sending data, and only fall back to TCP when the data to be transferred doesn't fit into a single UDP datagram. Of course, client programs have to have a way to find out which port a program number maps to.


1 Answers

Short answer:

RPC is the protocol. The socket provides access to the transport to implement that protocol.

RPC is the service and protocol offered by the operating system to allow code to be triggered for running by a remote application. It has a defined protocol by which procedures or objects can be accessed by another device over a network. An implementation of RPC can be done over basically any network transport (e.g. TCP, UDP, cups with strings).

The socket is just a programming abstraction such that the application can send and receive data with another device through a particular network transport. You implement protocols (such as RPC) on top of a transport (such as TCP) with a socket.

like image 86
selbie Avatar answered Oct 19 '22 13:10

selbie