Skip to content

Instantly share code, notes, and snippets.

@notedit
Created February 12, 2012 14:34
Show Gist options
  • Save notedit/1808851 to your computer and use it in GitHub Desktop.
Save notedit/1808851 to your computer and use it in GitHub Desktop.
test_client
package main
import (
"fmt"
"gogobservice"
"net/rpc"
"log"
)
func main(){
client,err := rpc.Dial("tcp",":9000")
args := gogobservice.Args{7,8}
var reply int
err = client.Call("Arith.Multiply",args,&reply)
if err != nil {
log.Fatal("arith error:",err)
}
fmt.Printf("Arith: %d*%d=%d",args.A,args.B,reply)
quotient := new(gogobservice.Quotient)
divCall := client.Go("Arith.Divide",args,&quotient,nil)
<-divCall.Done
fmt.Printf("%#v\n",quotient)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment