1、http服务器获取客户端的一些信息 示例: package main import ( "fmt" "net/http" ) //w, 给客户端回复数据 //r, 读取客户端发送的数据 func HandConn(w http.ResponseWriter, r ...
http客户端编程 示例: http server.go package main import fmt net http w, 给客户端回复数据 r, 读取客户端发送的数据 func HandConn w http.ResponseWriter, r http.Request fmt.Println r.Method , r.Method fmt.Println r.URL , r.URL f ...
2019-01-26 15:07 0 739 推荐指数:
1、http服务器获取客户端的一些信息 示例: package main import ( "fmt" "net/http" ) //w, 给客户端回复数据 //r, 读取客户端发送的数据 func HandConn(w http.ResponseWriter, r ...
一、Socket编程 1、什么是Socket Socket起源于Unix,而Unix基本哲学之一就是“一切皆文件”,都可以用“打开open –> 读写write/read –> 关闭close”模式来操作。Socket就是该模式的一个实现,网络的Socket数据传输是一种特殊的I ...
1、定时器停止 示例: package main import ( "fmt" "time" ) func main() { timer := time.NewTimer(3 * time.Second) go func() { <-timer.C ...
1、方法的重写 示例: //Person类型,实现了一个方法 func (tmp *Person) PrintInfo() { fmt.Printf("name=%s, sex=%c, a ...
1、json解析到结构体 示例: package main import ( "encoding/json" "fmt" ) type IT struct { Company s ...
1、recover的使用 示例: package main import "fmt" func testa() { fmt.Println("aaaaaaaaaaaaaaaaa") } ...
1、字符串转换 示例: package main import ( "fmt" "strconv" ) func main() { //转换为字符串后追加到字节数组 slice ...
[0] = 1 //int i[1] = "hello go" ...