So I\'m building a network app in Go and I\'ve seen that Conn.Read reads into a limited byte array, which I had created with make([]byte, 2048) and
Conn.Read
make([]byte, 2048)
You can use the ioutil.ReadAll function:
import ( "fmt" "io/ioutil" "net" ) func whois(domain, server string) ([]byte, error) { conn, err := net.Dial("tcp", server+":43") if err != nil { return nil, err } defer conn.Close() fmt.Fprintf(conn, "%s\r\n", domain) return ioutil.ReadAll(conn) }