最近做tcp编程,遇到接收
数据这个函数read,但对它的英文解释看不太懂,用过的朋友帮忙指导一下吧。
qint64 QIODevice::read ( char * data, qint64 maxSize )
Reads at most
maxSize bytes from the device into
data, and returns the number of bytes read. If an error occurs, such as when attempting to read from a device opened in
WriteOnly mode, this function returns -1.
0 is returned when no more data is available for reading. However, reading past the end of the stream is considered an error, so this function returns -1 in those cases (that is, reading on a closed socket or after a process has died).
返回 0 :没有数据可读了返回 -1:错误 However, reading past the end of the stream is considered an error???这句话不明白,和没有数据可读有什么区别,仅仅是先前接收了,后边接收完就返回-1么??
糊涂了,请各位老师们指导一下吧