buffer:=make([]byte,1024) readBytesLen,err:=tcpConn.Read(buffer)
How many conditions will readBytesLen be set value like -1,0,1?
readBytesLen
-1
0
1
<0 actually is impossible ==0 means read meet some questions like eof >0 means read is ok
<0
==0
eof
>0
Is there any wrong ?
I don’t think the general approach would involve the -1 case. (Unless it’s your own io. Reader) This value simply indicates how long the data has been read.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.