networking - golang: how to release a net.Conn from a bfio.Reader -


in go have net.conn wrap bufio.reader. want read , parse number of lines reader, , obtain control on net.conn, obtaining temporary data reader might still have buffered. there easy way it?

you can buffered data *bufio.reader using following code:

 p, _ := br.peek(br.buffered()) 

where p []byte containing buffered data , br *bufio.reader.

many applications use *bufio.reader io.reader after calling readline , related methods. there's no need buffered data in these applications. reader continue reading buffered data needed.


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo