【论坛、网站】:
一、数组及Slice
参考:http://www.jb51.net/article/57121.htm
二、go func问题 及 defer
func Server(listen *net.TCPListener) { for { conn, err := listen.AcceptTCP() if err != nil { fmt.Println("AcceptTCP_Err:", err.Error()) continue } fmt.Println("AcceptTCP_From:", conn.RemoteAddr().String()) defer conn.Close() go func() { data := make([]byte, 128) for { i, err := conn.Read(data) fmt.Println("AcceptTCP_data:", string(data[0:i])) if err != nil { fmt.Println("AcceptTCP_ReadErr:", err.Error()) break } conn.Write([]byte{'f', 'i', 'n', 'i', 's', 'h'}) } }() } }
相应理解参考:http://www.golangtc.com/t/563aeffbb09ecc3197000015
http://blog.csdn.net/eclipser1987/article/details/12089271
有疑问加站长微信联系(非本文作者)