开发者

Detecting I/O errors in a NON BLOCKING SOCKET

开发者 https://www.devze.com 2022-12-29 00:18 出处:网络
I am writing a client - server system in which I used NON-BLOCKING sockets. My problem is to detect error { while perfor开发者_如何学运维ming send() or write() } that may occur while data transfer. Ex

I am writing a client - server system in which I used NON-BLOCKING sockets. My problem is to detect error { while perfor开发者_如何学运维ming 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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消