2022年5月11日

go模拟网络数据包传送代码

摘要: 1.构建数据包过程 package protocol import ( "bufio" "bytes" "encoding/binary" "fmt" ) //构建网络中数据包格式 func Encode (message string ) []byte { var length = int32(l 阅读全文

posted @ 2022-05-11 21:12 孤灯引路人 阅读(108) 评论(0) 推荐(0) 编辑

go实现tcp通讯

摘要: 1.客户端代码 package main import ( "bufio" "fmt" "net" "os" "strings" ) func main(){ conn,err:= net.Dial("tcp","127.0.0.1:8890") if err != nil { fmt.Printl 阅读全文

posted @ 2022-05-11 21:10 孤灯引路人 阅读(224) 评论(0) 推荐(0) 编辑

导航