cap5lut
cap5lut
CC#
Created by ero on 2/12/2025 in #help
Named Pipe IPC: Protocols & Status Codes
the number of different high level data types doesnt matter, their serialization boils down to the primitives you want to support. at the transport layer you are just sending bytes over, maybe with some sequence and fragment number to support something like UDP where packets could arrive out of order, or simply dont arrive. the "hard" part here is only to discern which bytes belong to which message once thats done and dusted it goes to how to do the serialization, no matter if thats reflection based or source generated or manually writing it, which itself isnt that problematic either, and can also be abstracted away. ones all that is fixed u just need the application layer protocol, where the hard part is designing it. basically here the different types come into play, for requests, for responses. u want some generic status codes + optional data to process messages, pretty much like HTTP status codes.
62 replies
CC#
Created by ero on 2/12/2025 in #help
Named Pipe IPC: Protocols & Status Codes
and the actual application layer protocol for rpc u can build on top of that
62 replies
CC#
Created by ero on 2/12/2025 in #help
Named Pipe IPC: Protocols & Status Codes
i would abstract the transport layer and data (de)serialization away, so that u can first use simple stuff, like tcp and json and then make it configurable for faster alternatives like messagepack and named pipes/shared memory
62 replies
CC#
Created by ero on 2/12/2025 in #help
Named Pipe IPC: Protocols & Status Codes
the (de)serialization of 2) as well tho, but thats usually not the problematic thing
62 replies
CC#
Created by ero on 2/12/2025 in #help
Named Pipe IPC: Protocols & Status Codes
"consistency and modern technologies" would be mostly in the application and business layer
62 replies
CC#
Created by ero on 2/12/2025 in #help
Named Pipe IPC: Protocols & Status Codes
im not sure what ya mean by that. 1) would mean that u transfer a bunch of bytes, 2) would mean that u interpret that bunch of bytes.
62 replies
CC#
Created by ero on 2/12/2025 in #help
Named Pipe IPC: Protocols & Status Codes
well, with 1 and 2 there arent problems are there?
62 replies
CC#
Created by ero on 2/12/2025 in #help
Named Pipe IPC: Protocols & Status Codes
well, then u have these 4 layers to work on 😂
62 replies
CC#
Created by ero on 2/12/2025 in #help
Named Pipe IPC: Protocols & Status Codes
u basically have this: 1) transport (fixed via named pipes i guess) 2) serialization (a bit of a struggle but u do it somehow) 3) application layer protocol 4) business logic 3 seems to be what u are stuck at, right?
62 replies
CC#
Created by Sieg on 2/6/2025 in #help
Help me with C++ / C#
@Siegthis sounds a lot like u want to write some unit or integration tests. the question is what u really want to test. use the .NET test frameworks to test the C# side. use whatever c++ provides to test their side. testing the interoperability will become quite a big task
17 replies
CC#
Created by Sieg on 2/6/2025 in #help
Help me with C++ / C#
@Anton as far as i know .NET doesnt provide functionaility for c++ interop but only for C, and generally speaking they want to "reverse p/invoke"
17 replies
CC#
Created by Sieg on 2/6/2025 in #help
Help me with C++ / C#
basically for what you are looking for u are most likely need to host the runtime inside ur native code, unless u want to restrict urself to NAOT compiled libraries/programs, which itself is explained there: https://learn.microsoft.com/en-us/dotnet/core/tutorials/netcore-hosting and thats just a starter; you will need to read the whole (or at least most of the) "Native interoperablity" section
17 replies
CC#
Created by Sieg on 2/6/2025 in #help
Help me with C++ / C#
secondary u have to take into account, that C# (or .NET) uses garbage collection instead of explicitly freeing memory. and at that a compacting one, thus on the C# side, the addresses of references could change and make them invalid, if they were created on the C# side.
17 replies
CC#
Created by Sieg on 2/6/2025 in #help
Help me with C++ / C#
you can compile via NAOT to expose methods via the [UnmanagaedCalleryOnly] attribute. though, NAOT comes with with some restrictions.
17 replies
CC#
Created by Sieg on 2/6/2025 in #help
Help me with C++ / C#
if u want to call a c# method from c++ you have a lot to consider, first of that C# (or .NET) is usually not natively compiled in first place and thus do not expose functions/methods like ur typical C or C++ functions
17 replies
CC#
Created by Faker on 2/1/2025 in #help
Exception Handling in C#
(as a side note, there is actually a third kind of exception: the uncatchable, these u will not see unless u do something unsafe that is close to the system, its the kind of problems where the process itself can not recover from)
85 replies
CC#
Created by Faker on 2/1/2025 in #help
Exception Handling in C#
there are in the end 2 kinds of exceptions, one that indicate bugs (like ArgumentException, NullReferenceException) which u usually do not catch (or only catch them to log what went wrong) the other kind is failure that is outside of ur control (eg the internet connection died because ur wifi sucks, or the human ripped out the usb stick while u write to that file)
85 replies
CC#
Created by Faker on 2/1/2025 in #help
Exception Handling in C#
when to throw exceptions is quite use case dependent. ur math example: this is a bit more complex because the existence of NaN, its a value to indicate that an operation wasnt possible, without throwing. thats because often u have quite complex computations going on there and then check at certain points if its NaN to see if there is a failure (u dont want a try catch block for every division, do ya?) for the age of a person: as with each other, this type should maintain a stable state, because a negative age isnt possible, its the callers fault to provide the wrong values and it should throw an exception (an ArgumentOutOfRangeException in this case)
85 replies
CC#
Created by Faker on 2/1/2025 in #help
Exception Handling in C#
basically u want the state of ur class/type to be valid all the time, lets assume the DoSomethingThatMightThrow() method modifies ur internal state. due to the exception that state would become invalid the next time it is used, but catch the exception, fix the internal state to make it valid again, but still provide the caller with the exception of what went wrong
85 replies
CC#
Created by Faker on 2/1/2025 in #help
Exception Handling in C#
there is also one case i didnt mention yet, rethrow, basically u have something like
try
{
DoSomethingThatMightThrow();
}
catch (XyzException)
{
// #
throw;
}
try
{
DoSomethingThatMightThrow();
}
catch (XyzException)
{
// #
throw;
}
85 replies