-
Notifications
You must be signed in to change notification settings - Fork 4
/
main.go
34 lines (28 loc) · 905 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package main
import (
"log"
"net/rpc"
"github.com/artisoft-io/jetstore/jets/compute_pipes/tests/pcserv"
)
func main() {
// Address to this variable will be sent to the RPC server
// Type of reply should be same as that specified on server
args := &pcserv.PeerMessage{
RecordsCount: 22,
Records: []interface{}{"A", "B", "C"},
}
reply := pcserv.PeerReply{}
// DialHTTP connects to an HTTP RPC server at the specified network
client, err := rpc.DialHTTP("tcp", "127.0.0.1:8085")
if err != nil {
log.Fatal("Client connection error: ", err)
}
log.Println("Client connected, calling method")
// Invoke the remote function PushRecords
err = client.Call("PeerServer.PushRecords", args, &reply)
if err != nil {
log.Fatal("Client invocation error: ", err)
}
// Print the reply from the server
log.Printf("Got back a reply: %d Records :: %s", reply.RecordsCount, reply.ErrMsg)
}