tcp:这是go语言的TCP库的包装,实现了两个协议

时间:2024-06-05 05:04:03
【文件属性】:

文件名称:tcp:这是go语言的TCP库的包装,实现了两个协议

文件大小:8KB

文件格式:ZIP

更新时间:2024-06-05 05:04:03

Go

tcp This is a go language of the TCP Library of the packaging, the realization of the two agreements Server Demo 默认是基于json的与\r\n 分隔的协议 tcp.CreateServer(func(session *tcp.Session) { session.OnData(func(data[] byte) { fmt.Println("接收到数据: ",string(data)) }) }).Listen(":8020", func(err error, server *tcp.Server) { if err != nil { fmt.Println("创建服务器失败!", err) } else { fmt.Println("服务器创建成功!") } }) Clien


【文件预览】:
tcp-master
----tcp()
--------Client.go(3KB)
--------ProtoByte.go(4KB)
--------Server.go(2KB)
--------Session.go(4KB)
--------Protocol.go(619B)
--------ProtoJson.go(2KB)
----README.md(776B)

网友评论