如何循环直到* ipconn.Read()读取go中发送给它的所有数据

I was sending some data using *ipconn.Write method in go , but it seems *ipconn.Read() can only read 20 bytes at a time

here is server sending data

ln, err := net.Listen("tcp", "localhost:8888")
conn, err := ln.Accept()
tmp := make([]byte,10000)
tmp = []byte("abcdefghijklmnopqrstuvwxyz")
conn.Write(tmp)

here is the client receiving data

conn, err := net.Dial("tcp", "localhost:8888")
data := make([]byte, 100000)
conn.Read(data)
fmt.Println(string(data)) // prints only first 20 chars

If i again call conn.Read(data) I get another 20 characters

Is there any way to read all the data or loop until the connection is closed ?

ioutil.ReadAll will read all the data from the tcp stream. Be careful as it doesnt return until the connection has been closed.