service

package
v0.0.0-...-b8c1206 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(conn net.Conn) *Client

type RpcData

type RpcData struct {
	//访问的函数
	Name string
	//访问时的参数
	Args []interface{}
}

type Server

type Server struct {
	// contains filtered or unexported fields
}

声明服务端

func NewServer

func NewServer(addr string) *Server

构造方法

func (*Server) Register

func (s *Server) Register(rpcName string, f interface{})

服务端需要一个注册register 第一个参数函数名,第二个传入真正的函数

func (*Server) Run

func (s *Server) Run()

服务端等待调用的方法

type Session

type Session struct {
	// contains filtered or unexported fields
}

func NewSession

func NewSession(conn net.Conn) *Session

构造方法

func (*Session) Read

func (s *Session) Read() ([]byte, error)

从连接读数据

func (*Session) Write

func (s *Session) Write(data []byte) error

向连接中写数据

Jump to

Keyboard shortcuts

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