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 that, 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