How to know connection disconnected while receive paused
Tan Xiaofan
xfan1024 at live.com
Fri Jun 21 22:25:22 CEST 2019
Thank you for your reply,
I understand that this problem is not only use libev, but I still have some puzzles that I can't solve by myself.
> If you don't read, you can't detect a remote connection close, and in
> general, there is no way to do it, neither for you nor for libev - you
> have to read the data that was sent to you until you get EOF or an error.
If user space receive buffer is full, program can't call recv() because there is no buffer to use.
> Well, if thew other side closed the socket, then eventually you will get an error on send as well (most likely ECONNRESET).
I call send() before protocol stack receive FIN packet from client, it write a part of buffer(not completely) to tcp's send queue.
It should have waited a EV_WRITE event and continue to send remain data, but in this time protocol stack received client FIN packet,
so transmit will be stopped and EV_WRITE never to come again, I have no opportunity call send() again to get that ECONNRESET code.
Is there some way to handle this case?
More information about the libev
mailing list