81a37408163c0ea170c4e347f2798019867fe801.svn-base 350 B

1234567891011121314151617181920
  1. package main
  2. import (
  3. service "github.com/longjoy/micro-go-course/section16/service"
  4. "log"
  5. "net"
  6. "net/http"
  7. "net/rpc"
  8. )
  9. func main() {
  10. stringService := new(service.StringService)
  11. rpc.Register(stringService)
  12. rpc.HandleHTTP()
  13. l, e := net.Listen("tcp", "127.0.0.1:1234")
  14. if e != nil {
  15. log.Fatal("listen error:", e)
  16. }
  17. http.Serve(l, nil)
  18. }