Remote Procedure Call (RPC)

Remote Procedure Call (RPC) is a client-server mechanism for Interprocess communication that uses TCP/IP. Both the RPC client and the RPC server to be developed will use the following package, which is named sharedRPC.go:

package sharedRPC 
 
type MyFloats struct { 
    A1, A2 float64 
} 
 
type MyInterface interface { 
    Multiply(arguments *MyFloats, reply *float64) error 
    Power(arguments *MyFloats, reply *float64) error 
} 

The sharedRPC package defines one interface called MyInterface and one structure called MyFloats, which will be used by both the client and the server. However, only the RPC server will need to implement that interface.

After this, you will need to install the sharedRPC.go package by executing the following commands:

$ mkdir -p ~/go/src/sharedRPC
$ cp sharedRPC.go ~/go/src/sharedRPC/
$ go install sharedRPC  
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.141.28.107