Client/Server communication with Named Pipes
Most relevant code: https://gist.github.com/just-ero/a9bb60192a7cc090cb9055dc39770139
Context: I'm reading some information from Mono-based processes (mainly Unity games). For this, I use injection to call the Mono API. I have a client sending request codes and payloads to the server in the injected DLL, which sends response payloads.
Unfortunately, I feel like I've made quite some missteps in designing this process. For example:
I would like some help in making this whole system more robust and more intuitive to use and expand upon. I would like a way to add logging (ideally in the form
I'm on .NET Standard 2.0 for all of this, so a lot of features simply aren't available to me.
Context: I'm reading some information from Mono-based processes (mainly Unity games). For this, I use injection to call the Mono API. I have a client sending request codes and payloads to the server in the injected DLL, which sends response payloads.
Unfortunately, I feel like I've made quite some missteps in designing this process. For example:
- I cannot send a "failure" response; I simply send a response payload with default values,
- I cannot log,
- Request codes are not tightly coupled with their respective request payloads,
- When the client side does not shut down gracefully, the server side does not shut down (because
IsConnectedis never set tofalse), - The server library has to implement the loop for listening manually, I'd like that to be part of the server class itself.
Result type).I would like some help in making this whole system more robust and more intuitive to use and expand upon. I would like a way to add logging (ideally in the form
[ServerName] [Method] Actual Log). I would like to shut down (or halt) the server when the client does not shut down gracefully. And I would like someone to look over my ApiSerializer class to spot anything that can be written better. The entire way I exchange data feels very opaque and convoluted (I even get confused myself).I'm on .NET Standard 2.0 for all of this, so a lot of features simply aren't available to me.