检测非阻塞套接字中的 I/O 错误

发布于 2024-08-31 03:36:48 字数 182 浏览 3 评论 0原文

我正在编写一个客户端-服务器系统,其中使用非阻塞套接字。我的问题是检测数据传输时可能发生的错误 { while Performing send() or write() } 。举例来说,当数据正在传输时,对等点崩溃了。另一种情况是存在一些网络问题,比如电线被拔掉等。

到目前为止,我使用的是高级 ACK,该对等方在收到完整数据后发送。

I am writing a client - server system in which I used NON-BLOCKING sockets. My problem is to detect error { while performing send() or write() } that may occur while data transfer. Example lets say, while the data is being transferred the peer crashes. Another case there is some network problem, something like wire unplugged etc.

As of now, I am using a high level ACK, that peer sends after receiving the complete data.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不必了 2024-09-07 03:36:48

由于您的应用程序和 NIC 之间存在套接字发送缓冲区,因此事件和通知之间可能会有延迟,但最终您在写入时会遇到“连接重置”情况。

As there is a socket send buffer between your application and the NIC there may be a delay between the event and the notification, but eventually you will get a 'connection reset' condition when writing.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文