c# - How best to handle an unexpected socket error? -
c# - How best to handle an unexpected socket error? -
i have chat client class
class chatclient { task connectasync(string server); task sendmessageasync(string message); task disconnectasync(); }
once user has connected connectasync able phone call sendmessageasync send messages other users.
under hood there connection class basic wrapper socket class. 1 of main differences has onerror event.
i'm using observable message stream (reactive extensions) reads connection , produces stream of incoming commands server.
my question - when socket produces error, best handle error from? should handle within onerror event handler, or should intercept error observable stream , handle there?
i can't see upside or downside either way, i'm wondering best practice dictates?
something having event on connection class has struck me beingness little hacky, don't know why.
any suggestions? thanks
i have best solution ever transparent end user. if error affects user in way should notified or given selection of how proceed. if not possible notify user handle error in way allows easy future improvements.
c# sockets system.reactive
Comments
Post a Comment