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" ...