上一页 1 2 3 4 5 6 7 ··· 13 下一页
摘要: ``` ➜ recipe07 tree . . ├── html │ └── page.html ├── static.go └── welcome.txt 1 directory, 3 files ``` ```go package main import ( "net/http" ) func main() { fileSrv := http.FileServer(htt... 阅读全文
posted @ 2018-03-27 00:08 cucy_to 阅读(103) 评论(0) 推荐(0)
摘要: ```go package main import ( "io" "log" "net/http" ) type User string func (u User) toString() string { return string(u) } type AuthHandler func(u User 阅读全文
posted @ 2018-03-26 23:52 cucy_to 阅读(187) 评论(0) 推荐(0)
摘要: ```go package main import ( "fmt" "net/http" ) func main() { mux := http.NewServeMux() mux.HandleFunc("/user", func(w http.ResponseWriter, r *http.Request) { if r.Method == http.MethodGet { ... 阅读全文
posted @ 2018-03-26 23:38 cucy_to 阅读(116) 评论(0) 推荐(0)
摘要: ```go package main import ( "fmt" "net/http" ) type SimpleHTTP struct{} func (s SimpleHTTP) ServeHTTP(rw http.ResponseWriter, r *http.Request) { fmt.Fprintln(rw, "Hello world") } func main() { ... 阅读全文
posted @ 2018-03-26 23:32 cucy_to 阅读(121) 评论(0) 推荐(0)
摘要: ```go package main import ( "bufio" "fmt" "io" "net" ) func main() { l, err := net.Listen("tcp", ":8080") if err != nil { panic(err) } ID := 0 for { fmt.Println("Waiting for client...... 阅读全文
posted @ 2018-03-26 23:30 cucy_to 阅读(111) 评论(0) 推荐(0)
摘要: ```go package main import ( "fmt" "log" "net" ) func main() { pc, err := net.ListenPacket("udp", ":7070") if err != nil { log.Fatal(err) } defer pc.Close() buffer := make([]byte, 2048) ... 阅读全文
posted @ 2018-03-26 21:48 cucy_to 阅读(115) 评论(0) 推荐(0)
摘要: 出现原因 GO type DB struct { mutex sync.Mutex store map[string][3]float64 } func (db DB) nearest(target [3]float64) string { var filename string db.mutex. 阅读全文
posted @ 2018-03-24 12:32 cucy_to 阅读(386) 评论(0) 推荐(0)
摘要: 死锁 go package main import "fmt" func callerA(c chan string) { c 阅读全文
posted @ 2018-03-24 11:12 cucy_to 阅读(169) 评论(0) 推荐(0)
摘要: ```go package main import ( "bufio" "fmt" "io" "net" ) func main() { l, err := net.Listen("tcp", ":8080") if err != nil { panic(err) } for { fmt.Println("Waiting for client...") conn... 阅读全文
posted @ 2018-03-24 00:06 cucy_to 阅读(110) 评论(0) 推荐(0)
摘要: ```go package main import ( "log" "net" "net/rpc" "net/rpc/jsonrpc" ) type Args struct { A, B int } type Result int type RpcServer struct{} func (t RpcServer) Add(args *Args, result *Result)... 阅读全文
posted @ 2018-03-24 00:04 cucy_to 阅读(92) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 7 ··· 13 下一页