gfgtcp

module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2021 License: MIT

README

tcp-based-on-gf-gtcp

介绍

基于gf-gtcp的二次小封装,主要是用gmap组合了conn/client/自定义uid,以便可以从服务端快速向指定的客户端发送消息

安装教程

go get gitee.com/hello-rong/gfgtcp

使用示例
package main

import (
	"gitee.com/hello-rong/gfgtcp/svr"
    "github.com/gogf/gf/net/gtcp"
)

func main() {

	server := svr.NewServerService
	server.SetServerAddress("127.0.0.1:8999")
	server.SetServerName("svr0")
	server.SetMessageHandler(onMessage)
	_ = server.NewServer()

}

func onMessage(conn *gtcp.Conn, message []byte) {
    //......
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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