gcnet

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ClientMap = make(map[net.Addr]net.Conn)
View Source
var NetHandlerMap = make(map[string]NetHandler)

Functions

func Client

func Client()

func Decode

func Decode(reader *bufio.Reader) ([]byte, error)

Decode 解码数据包

func Encode

func Encode(mes []byte) ([]byte, error)

Encode 将数据包编码(即加上包头再转为二进制)

func RegistNetHandler

func RegistNetHandler(cmd string, f NetHandler)

func Server

func Server(host string, port int, protocol string) error

Types

type NetHandler

type NetHandler func(data interface{}, conn net.Conn)

Jump to

Keyboard shortcuts

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