首页 > linux c socket read方法的疑问?

linux c socket read方法的疑问?

问下linux c socket read方法是不是遇到\r\n会自动返回?
还是需要程序主动分割,比如一个一个字节的读取,遇到\r\n就表示一条消息读取完毕.


ssize_t read(int fd, void *buf, size_t count);

On success, the number of bytes read is returned (zero indicates end of file),It is not an error if this number is smaller than the number of bytes requested; this may happen for example because fewer bytes

   are  actually  available  right  now

不是read么?我还以为是别的什么呢。去查read接口文档吧


所有的数据是当做字节流输入输出,需要应用程序切割或粘包。

【热门文章】
【热门文章】