views:

44

answers:

1

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.

Ripunjay Tripathi

A: 

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.

EJP
Yeah, I understand. Actually I am sending "messages" to the peer. And let say if the socket goes to some wait state before it declares the CONNECTION LOST, and I keep on sending different messages to peer, all of them will keep on depositing in send buffer, and eventually when I get the error on some write(), how would I know how many messages actually failed ?
RIPUNJAY TRIPATHI
The only way is to require the peer to ack each message it receives.
Remy Lebeau - TeamB