package connection import ( "net" ) const defaultBufSize = 1 * 1024 // Connection represents a recv-only network connection. type Connection struct { BufSize int conn *net.TCPConn dataChan chan []byte stopFlag bool } // Close closes the connection func (c *Connection) Close() { c.stopFlag = true c.conn.Close() }