func main() {
	arith := new(Arith)
	rpc.Register(arith)
	rpc.HandleHTTP()
	l, e := net.Listen("tcp", ":33771")
	if e != nil {
		log.Fatalf("listen error: %v", e)
	}

	go http.Serve(l, nil)
	Sayhello()

	sch := make(chan os.Signal, 1)
	signal.Notify(sch, os.Interrupt, os.Kill)

	go func() {
		client, err := rpc.DialHTTP("tcp", "127.0.0.1:33771")
		if err != nil {
			log.Fatal("dial failed.", err)
		}

		args := &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\n",args.A, args.B, reply)
		close(sch)
	}()

	<-sch
	fmt.Println("Server down.")
}
/*
There is a test application
 */
There is a test application
/ * There is a test application * /
func main() {
	arith := new(Arith)
	rpc.Register(arith)
	rpc.HandleHTTP()
	l, e := net.Listen("tcp", ":33771")
	if e != nil {
		log.Fatalf("listen error: %v", e)
	}
	go http.Serve(l, nil)
	Sayhello()
	sch := make(chan os.Signal, 1)
	signal.Notify(sch, os.Interrupt, os.Kill)
	go func() {
		client, err := rpc.DialHTTP("tcp", "127.0.0.1:33771")
		if err != nil {
			log.Fatal("dial failed.", err)
		}
		args := &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\n",args.A, args.B, reply)
		close(sch)
	}()
	<-sch
	fmt.Println("Server down.")
}
func main ( ) { arith := new ( Arith ) rpc . Register ( arith ) rpc . HandleHTTP ( ) l , e := net . Listen ( " " , " " ) if e != nil { log . Fatalf ( " " , e ) } go http . Serve ( l , nil ) Sayhello ( ) sch := make ( chan os . Signal , 1 ) signal . Notify ( sch , os . Interrupt , os . Kill ) go func ( ) { client , err := rpc . DialHTTP ( " " , " " ) if err != nil { log . Fatal ( " " , err ) } args := & Args { 7 , 8 } var reply int err = client . Call ( " " , args , & reply ) if err != nil { log . Fatal ( " " , err ) } fmt . Printf ( " \n " , args . A , args . B , reply ) close ( sch ) } ( ) <- sch fmt . Println ( " " ) }
There is a test application
There is a test application