开发者社区 问答 正文

linux c socket read方法的疑问?

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

展开
收起
a123456678 2016-06-12 10:46:58 2032 分享 版权
1 条回答
写回答
取消 提交回答
  • 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
    2019-07-17 19:33:25
    赞同 展开评论