NetUV icon indicating copy to clipboard operation
NetUV copied to clipboard

OnError never called

Open egmkang opened this issue 6 years ago • 6 comments

run sample EchoServer, and telnet 127.0.0.1 9988, and then close telnet window

the sample will print

dbug: ScheduleHandle[0]
      UV_TCP 1859236454736 read completed.
trce: ScheduleHandle[0]
      UV_TCP 1859236454736 Read stopped

but OnError callback never be called.

egmkang avatar Jan 06 '20 11:01 egmkang

@StormHub https://github.com/StormHub/NetUV/blob/8ecc25e1656f94caf9b1dadb155e54c629d4dae6/src/NetUV.Core/Handles/StreamHandle.cs#L315

End of file is not an error, so OnError will not be called.....

egmkang avatar Jan 06 '20 11:01 egmkang

I think OnError is not supposed to be called in this case.

StormHub avatar Jan 06 '20 13:01 StormHub

@StormHub so how can i get the event, which the socket has been closed by remote

egmkang avatar Jan 07 '20 04:01 egmkang

@StormHub http://think-async.com/Asio/asio-1.12.2/doc/asio/reference/async_read.html

system call read return 0 may not be an error, but application want to know this event, this is important

egmkang avatar Jan 07 '20 04:01 egmkang

Yep, I got the idea but now I am wondering how to expose this. For example, it could be a read complete with error or simply expose as error. Any preference from you?

StormHub avatar Jan 20 '20 02:01 StormHub

all ways will be ok for me. thanks.

egmkang avatar Jan 20 '20 08:01 egmkang