socket read write


在socket编程的时候,会发现并不是一个send,一个read,然后第二次read还会阻塞,会看到第二次read返回0,即使没有设置non-blocking。所以最好是要设置一些终止符表示消息结束了,比如连续的两个换行。
写代码的时候注意一点规范后期维护起来会更舒服。


Author: 蒋璋
Reprint policy: All articles in this blog are used except for special statements CC BY 4.0 reprint polocy. If reproduced, please indicate source 蒋璋 !