Closed ThomasZeman closed 7 years ago
Howdy!
Thanks for this and the other issue with good observations. For this one, I think changing the signature is a good move; but I don't think it can be awaited as it would halt at the call site until the socket failed or disconnected.
One approach I've tried in the past is like this, exposing the errors through an event. Thoughts?
Looks better without the async void signature. Two other things: I would avoid copying arrays whenever possible especially in high frequent call scenarios. Also maybe consider instead of deriving from MemoryStream derive from Stream directly and aggregate MemoryStream if needed plus override the Async methods.
In e.g. UpdSocketBase (Android) the method RunMessageReceiver has an "async void" signature which can lead to program/app crashes which are hard to understand and analyse. The signature should be changed to "async Task" and awaited in e.g. StartListeningAsync.