Skip to content

SharmIpc + SharmNpc

Choose a tag to compare

@hhblaze hhblaze released this 12 Apr 11:27
· 24 commits to master since this release
// Added SharmNpc which works under .NET 6+ on Linux (Named MemoryMappedFiles are not supported there).
// Both versions are included and usable. SharmNpc is based on Named Pipes and serves as a complete drop-in replacement.
// With SharmNpc, one process becomes the server and another becomes the client.
// Previously, we used:
tiesky.com.SharmIpc sm = null;
// Now we can change to:
tiesky.com.ISharm sm = null;
// and use either SharmIpc (Windows) or SharmNpc (Windows/Linux).

// Server listener
sm = new tiesky.com.SharmNpc("MNPC", tiesky.com.SharmNpcInternals.PipeRole.Server, this.RemoteCall);
// Client connector
sm = new tiesky.com.SharmNpc("MNPC", tiesky.com.SharmNpcInternals.PipeRole.Client, this.AsyncRemoteCallHandler);

// The rest remains the same - it's a drop-in replacement.
// Note: Currently there's a connection timeout (if server or client waits longer than 30 seconds for connection establishment, it aborts).
// Also, after establishing communication, if one peer disconnects, the other doesn't automatically restore listening/connecting behavior.
// These behaviors can be customized, but represent different implementation strategies.
// In this initial SharmNpc version, we don't provide configuration flexibility for these scenarios - this may be added in future updates or by request.

//Check Process1 and Process2 folder for the examples.