StormHub / NetUV

.Net standard/Core binding for Libuv
Other
76 stars 20 forks source link

OnError never called #80

Open egmkang opened 4 years ago

egmkang commented 4 years ago

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 commented 4 years ago

@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.....

StormHub commented 4 years ago

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

egmkang commented 4 years ago

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

egmkang commented 4 years ago

@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

StormHub commented 4 years ago

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?

egmkang commented 4 years ago

all ways will be ok for me. thanks.