Thread 1 "logServer" received signal SIGPIPE, Broken pipe.
0x00007ffff7bc5a9e in __libc_send (fd=5, buf=0x5555555b2918, len=17, flags=0) at ../sysdeps/unix/sysv/linux/send.c:28
28      ../sysdeps/unix/sysv/linux/send.c: No such file or directory.

开发中遇到了如上所示的问题,是因为 TCP的通讯过程中对端断开而引起的。 对于这个问题,再网上找了一些答案 最终的处理方法就是在send() 函数的标志位中增加 MSG_NOSIGNAL 选项。

ret = send(this->rwfd[i],buf,size,MSG_NOSIGNAL);
Logo

技术共进,成长同行——讯飞AI开发者社区

更多推荐