1、http客户端编程 示例: http_server.go package main import ( "fmt" "net/http" ) //w, 给客户端回复数据 //r, 读取客户端发送的数据 func HandConn(w http.ResponseWriter ...
一 Socket编程 什么是Socket Socket起源于Unix,而Unix基本哲学之一就是 一切皆文件 ,都可以用 打开open gt 读写write read gt 关闭close 模式来操作。Socket就是该模式的一个实现,网络的Socket数据传输是一种特殊的I O,Socket也是一种文件描述符。Socket也具有一个类似于打开文件的函数调用:Socket ,该函数返回一个整型的S ...
2019-01-21 14:52 0 794 推荐指数:
1、http客户端编程 示例: http_server.go package main import ( "fmt" "net/http" ) //w, 给客户端回复数据 //r, 读取客户端发送的数据 func HandConn(w http.ResponseWriter ...
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" ...
1、WriteString的使用 示例: package main import ( "fmt" "os" ) func WriteFile(path string) { f, e ...