McComms.Core 1.1.2

dotnet add package McComms.Core --version 1.1.2
                    
NuGet\Install-Package McComms.Core -Version 1.1.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="McComms.Core" Version="1.1.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="McComms.Core" Version="1.1.2" />
                    
Directory.Packages.props
<PackageReference Include="McComms.Core" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add McComms.Core --version 1.1.2
                    
#r "nuget: McComms.Core, 1.1.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package McComms.Core@1.1.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=McComms.Core&version=1.1.2
                    
Install as a Cake Addin
#tool nuget:?package=McComms.Core&version=1.1.2
                    
Install as a Cake Tool

McComms.Core

Base project with common interfaces, models and helpers for the McComms solution. This library provides the basic structure for communication between clients and servers using different technologies. Once implemented, it can be extended to support various transport mechanisms like Sockets, WebSockets, or gRPC.

Communication Interfaces

ICommsServer

Interface that defines the operations of a communications server:

  • Address: Gets the address of the server.
  • Start(Func<CommandRequest, CommandResponse>?, CancellationToken): Starts the server with a callback for received commands.
  • Stop(): Stops the server.
  • StopAsync(): Stops the server asynchronously.
  • SendBroadcast(BroadcastMessage): Sends a broadcast message to all connected clients.
  • SendBroadcastAsync(BroadcastMessage, CancellationToken): Sends a broadcast message to all connected clients asynchronously.
ICommsClient

Interface that defines the operations of a communications client:

  • Address: Gets the address of the server.
  • Connect(Action<BroadcastMessage>?): Connects to the server and sets the callback for broadcast messages.
  • ConnectAsync(Action<BroadcastMessage>?, CancellationToken): Connects to the server asynchronously and sets the callback for broadcast messages.
  • Disconnect(): Disconnects from the server.
  • DisconnectAsync(): Disconnects from the server asynchronously.
  • SendCommand(CommandRequest): Sends a command to the server and returns the response.
  • SendCommandAsync(CommandRequest, CancellationToken): Sends a command to the server asynchronously and returns the response.
  • OnBroadcastReceived: Property that sets the callback for received broadcast messages.

Data Models

CommandRequest

Record that represents a command request:

  • Id: Numeric identifier of the command.
  • Message: Message associated with the command.
  • ToString() method: Returns the representation in "Id:Message" format.
CommandResponse

Record that represents a response to a command:

  • Success: Indicates whether the command was processed successfully.
  • Id: Command identifier.
  • Message: Response message.
  • ToString() method: Returns the representation in "Success:Id:Message" format.
BroadcastMessage

Record that represents a broadcast message:

  • Id: Numeric identifier of the message.
  • Message: Content of the message.
  • ToString() method: Returns the representation in "Id:Message" format.

Helpers and Extensions

McCommsExtensions

Class with extension methods for processing communication formats:

  • TryParseCommandRequest(string): Attempts to parse a string in "Id:Message" format into a CommandRequest.
  • TryParseCommandResponse(string): Attempts to parse a string in "Success:Id:Message" format into a CommandResponse.
  • TryParseBroadcastMessage(string): Attempts to parse a string in "Id:Message" format into a BroadcastMessage.

Implementations

This core library is implemented by other projects in the solution:

  • McComms.gRPC: Implementation using gRPC.
  • McComms.Sockets: Implementation using TCP sockets.
  • McComms.WebSockets: Implementation using WebSockets.

Author

Joan Magnet

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net9.0

    • No dependencies.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on McComms.Core:

Package Downloads
McComms.Sockets

Sockets implementation for McComms

McComms.gRPC

gRPC implementation for McComms

McComms.WebSockets

WebSockets implementation for McComms

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.2 168 9/1/2025
1.1.1 157 9/1/2025
1.1.0 115 8/22/2025
1.0.9 121 8/22/2025
1.0.8 137 8/21/2025
1.0.7 130 8/21/2025
1.0.6 143 8/21/2025
1.0.5 141 8/19/2025
1.0.4 246 5/28/2025
1.0.3 194 5/28/2025