Re: [go-nuts] tcp net.Conn deadlocks when message size increased

2018-03-09 Thread pierspowlesland
Thanks so much, I had in fact been using buffered readers and writers, for this test and had removed them to make my example more lean, forgetting that the read and write methods behave differently to those of net.Conn. My original problem when using the buffered readers and writers is that I h

Re: [go-nuts] tcp net.Conn deadlocks when message size increased

2018-03-09 Thread andrey mirtchovski
it deadlocks because you're not reading all the data. Read() may return "up to len(p)", but not necessarily the whole thing. the reader should loop until it reads all available bytes in your case you know how many bytes you are going to write beforehand. if you do not ignore the first value return

Re: [go-nuts] tcp net.Conn deadlocks when message size increased

2018-03-09 Thread Burak Serdar
Read stops reading if it needs to block. https://play.golang.org/p/TwtGzzBEnXV On Fri, Mar 9, 2018 at 8:44 AM, wrote: > Hi all > > I've written a simple program which simply sends a message across a tcp > connection and back again. > > For some reason when I make the buffer larger than a certai

[go-nuts] tcp net.Conn deadlocks when message size increased

2018-03-09 Thread pierspowlesland
Hi all I've written a simple program which simply sends a message across a tcp connection and back again. For some reason when I make the buffer larger than a certain size the program deadlocks. When run on the playground with datalen set to 1 the program deadlocks but with datalen set to