rpc

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 9, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

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)
}
...

Documentation

Index

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL