Re: [go-nuts] How can stop a Read of net.Conn without closing it

2019-06-04 Thread Ian Lance Taylor
On Tue, Jun 4, 2019 at 9:56 AM 杜沁园 wrote: > > When there is no data in tcp connection, net.Conn.Read will block. > > Then I want to cancel the net.Conn.Read from another goroutine, But I do > not want to close the connection, Because I will reuse it latter. How to > write the code??? > >

[go-nuts] How can stop a Read of net.Conn without closing it

2019-06-04 Thread 杜沁园
When there is no data in tcp connection, net.Conn.Read will block. Then I want to cancel the net.Conn.Read from another goroutine, But I do not want to close the connection, Because I will reuse it latter. How to write the code??? For example: func (p *proxy) toClient(ctx context.C