From the libevent documentation, I understand that when a TCP segment is received from the remote peer, an EV_READ event is generated. What happens in the following scenario
- Non blocking application having registered for both read and write events on the socket
- Scenario A : Application is waiting for an event. It gets a FIN from remote, EV_READ event is generated, application does a read(or recv) and gets 0
- Scenario B: Application is sending data. It gets a FIN from remote while the send is being executed. Will the application get an EPIPE (I think so). Will there also be an EV_READ event generated for the same FIN for which the application gets an EPIP
A related question is that if send and write are similar as mentioned in this, then why is ECONNRESET not generated in write as in the manual page here but generated in send as described in the manual page here.
How do I write a remote peer so that the local send returns an ECONNRESET. Thanks for any answers