Documentation
¶
Overview ¶
* @Author: soso * @Date: 2022-01-26 10:56:33 * @LastEditTime: 2022-03-03 17:51:06 * @LastEditors: Please set LastEditors * @Description: sonet传输包 * @FilePath: /go-mesh-sync/go-utils/utils/sonet/command.go
* @Author: soso * @Date: 2022-01-26 10:56:33 * @LastEditTime: 2022-01-26 11:23:25 * @LastEditors: soso * @Description: 网络数据打包解包 * @FilePath: /go-mesh-sync/go-utils/utils/sonet/datapack.go
* @Author: soso * @Date: 2022-01-27 17:52:43 * @LastEditTime: 2022-02-16 15:30:36 * @LastEditors: Please set LastEditors * @Description: 发包,收包 * @FilePath: /sync-client/go-utils/utils/sonet/net.go
Index ¶
- Constants
- func Read(conn net.Conn) (uint32, []byte, error)
- func ReceiveLongData(conn net.Conn, callbackFunc func([]byte) bool) error
- func SendFileData(conn net.Conn, filePath string, offset, expectSize int64, ...) (int, error)
- func SendPack(conn net.Conn, msgId uint32, data []byte) (err error)
- func TimeoutConn(ip string, port int) (conn net.Conn, err error)
- func Write(conn net.Conn, command []byte) error
- type DataPack
- type IDataPack
- type IMessage
- type Message
- type Pool
Constants ¶
View Source
const (
RetryTimes = 3
)
Variables ¶
This section is empty.
Functions ¶
func ReceiveLongData ¶
*
- @description: 接收长数据
- @param {net.Conn} conn
- @param {func} callbackFunc
- @return {error}
Types ¶
type IMessage ¶
type IMessage interface { GetDataLen() uint32 //获取消息数据段长度 GetMsgId() uint32 //获取消息ID GetData() []byte //获取消息内容 SetMsgId(uint32) //设计消息ID SetData([]byte) //设计消息内容 SetDataLen(uint32) //设置消息数据段长度 }
将请求的一个消息封装到message中,定义抽象层接口
Click to show internal directories.
Click to hide internal directories.