go-netty icon indicating copy to clipboard operation
go-netty copied to clipboard

read header fail

Open thirdparty-core opened this issue 2 years ago • 1 comments

作者您好: 我使用LengthFieldCodec来处理客户端发送的数据时,我客户端发送的数据是: data.length + data 我服务端代码如下:

AddLast(frame.LengthFieldCodec(binary.BigEndian, 1 << 20, 0, 4, 0, 4))

我的目标是只想得到最终data,根据上面代码,我能拿到最终的data,但是在最后抛出了如下异常:

exception: read header fail, headerLength: 4, read: 0, error: EOF
goroutine 19 [running]:

而我用java的 image 是可以正常得到结果,并不会抱错,所以我应该怎么设置这个LengthFieldCodec的参数,让其能得到数据数据的同时,不会抛出异常? 期待您的回复。 祝好!

thirdparty-core avatar Nov 09 '21 08:11 thirdparty-core

你这个看像还没读取到数据,对端就关闭了

limpo1989 avatar Nov 09 '21 09:11 limpo1989