2 Star 1 Fork 0

法马智慧 / fmgo

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
interface.go 569 Bytes
一键复制 编辑 原始数据 按行查看 历史
Asdybing 提交于 2022-04-08 10:17 . 增加tcp封包
package tcpx
import (
"context"
)
/* tcp库用到的接口定义 */
// Socket tcp通讯需要的一些回调函数
type Socket interface {
OnConnect(*Conn) error // 连接建立时
OnError(error) // 连接发生错误
OnClose(*Conn, error) // 关闭连接时
OnRecMessage(context.Context, *Conn, []byte) // 接收消息时
}
// ServerSocket 服务接口,实例化tcp server时传次参数
type ServerSocket interface {
Socket
GetClientID() string // 获取session id生成规则
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/fmpt/fmgo.git
git@gitee.com:fmpt/fmgo.git
fmpt
fmgo
fmgo
v1.6.0

搜索帮助

344bd9b3 5694891 D2dac590 5694891