README ¶ gitub.com/gkzy/gku/lib/rpc server // InitRPCServer func InitRPCServer(){ g,err:=rpc.NewServer(10001) if err!=nil{ panic(err) } handler(g.Server) g.Run() } // handler register struct func handler(g *rpc.Server){ } client client,err:=rpc.NewClient("192.168.0.100",10001) if err!=nil{ panic(err) } ... Expand ▾ Collapse ▴ Documentation ¶ Index ¶ func NewClient(serverAddr string, serverPort int) (client *grpc.ClientConn, err error) type Server func NewServer(port int) (server *Server, err error) func (m *Server) Run() Constants ¶ This section is empty. Variables ¶ This section is empty. Functions ¶ func NewClient ¶ func NewClient(serverAddr string, serverPort int) (client *grpc.ClientConn, err error) NewClient 返回rpc客户端 serverAddr:服务端地址 serverPort:服务端Port Types ¶ type Server ¶ type Server struct { Listener net.Listener Server *grpc.Server Port int //端口 } Server GRPCServer func NewServer ¶ func NewServer(port int) (server *Server, err error) NewServer init一个新的服务 func (*Server) Run ¶ func (m *Server) Run() Run run rpc server Source Files ¶ View all Source files client.go server.go Click to show internal directories. Click to hide internal directories.