import "github.com/daviddengcn/go-rpc"
This rpc package <https://github.com/daviddengcn/go-rpc> uses HTTP requests
to server the service. (godoc<http://godoc.org/github.com/daviddengcn/go-rpc>
Unlike the buildin package net/rpc, the accepted methods can be much
flexible. Paramters are input, and return values are output, they must all
be exported as JSON. No number limits.
A simple example:
//// The server model
type Arith int
func (*Arith) Add(a, b int) int {
return a + b
//// Server
Register(new(Arith))
http.ListenAndServe(":1235", nil)
//// Client
client := NewClient(http.DefaultClient, "http://localhost:1235")
A, B := 1, 2
var C int
err := client.Call(2, "Add", A, B, )
Have fun!
David
This rpc package <https://github.com/daviddengcn/go-rpc> uses HTTP requests
to server the service. (godoc<http://godoc.org/github.com/daviddengcn/go-rpc>
Unlike the buildin package net/rpc, the accepted methods can be much
flexible. Paramters are input, and return values are output, they must all
be exported as JSON. No number limits.
A simple example:
//// The server model
type Arith int
func (*Arith) Add(a, b int) int {
return a + b
//// Server
Register(new(Arith))
http.ListenAndServe(":1235", nil)
//// Client
client := NewClient(http.DefaultClient, "http://localhost:1235")
A, B := 1, 2
var C int
err := client.Call(2, "Add", A, B, )
Have fun!
David