August 2019
Beginner to intermediate
798 pages
17h 2m
English
The RPC server will be saved as RPCserver.go, and it is presented in five parts.
The first part of RPCserver.go is as follows:
package main
import (
"fmt"
"math"
"net"
"net/rpc"
"os"
"sharedRPC"
)
The second segment of RPCserver.go contains the following Go code:
type MyInterface struct{}
func Power(x, y float64) float64 {
return math.Pow(x, y)
}
func (t *MyInterface) Multiply(arguments *sharedRPC.MyFloats, reply *float64) error {
*reply = arguments.A1 * arguments.A2
return nil
}
func (t *MyInterface) Power(arguments *sharedRPC.MyFloats, reply *float64) error {
*reply = Power(arguments.A1, arguments.A2)
return nil
}
In the preceding Go code, the RPC server implements the desired interface, as well as a helper function named ...
Read now
Unlock full access