How to get the size of available TCP data?
Clash Royale CLAN TAG #URR8PPP How to get the size of available TCP data? Problem I have a use case where I need to Peek at exactly the first TCP packet, whatever length it may be. Peek Snippet I would have expected this to work: conn, err := sock.Accept() if nil != err { panic(err) } // plenty of time for the first packet to arrive time.Sleep(2500 * 1000000) bufConn := bufio.NewReader(conn) n := bufConn.Buffered() fmt.Fprintf(os.Stdout, "Size of Buffered Data %dn", n) However, even though I am positive that the data has arrived it still shows that 0 bytes are buffered. Full Test Application Here's a full test program: package main import ( "bufio" "fmt" "net" "os" "strconv" "time" ) func main () { addr := ":" + strconv.Itoa(4080) sock, err := net.Listen("tcp", addr) if nil != err { panic(err) } conn, err := sock.Accept() if nil != e...