EonaCat.FastNetwork 1.0.0

Prefix Reserved
dotnet add package EonaCat.FastNetwork --version 1.0.0
                    
NuGet\Install-Package EonaCat.FastNetwork -Version 1.0.0
                    
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="EonaCat.FastNetwork" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="EonaCat.FastNetwork" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="EonaCat.FastNetwork" />
                    
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 EonaCat.FastNetwork --version 1.0.0
                    
#r "nuget: EonaCat.FastNetwork, 1.0.0"
                    
#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 EonaCat.FastNetwork@1.0.0
                    
#: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=EonaCat.FastNetwork&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=EonaCat.FastNetwork&version=1.0.0
                    
Install as a Cake Tool

πŸ”₯ EonaCat.FastNetwork πŸ”₯

A lightweight, asynchronous, and secure networking framework for C# that provides TCP and UDP client-server communication with built-in AES encryption, SSL/TLS support, auto-reconnection, and heartbeat monitoring.

This project contains:

  • FastNetworkClient β€” A configurable client capable of connecting to servers over TCP or UDP.
  • FastNetworkServer β€” A high-performance server capable of managing multiple clients, broadcasting messages, and monitoring connections.

πŸš€ Features

βœ… Supports both TCP and UDP communication
βœ… Asynchronous I/O with async/await
βœ… Optional AES encryption for secure communication
βœ… Optional SSL/TLS (via SslStream)
βœ… Automatic reconnection logic for clients
βœ… Heartbeat system for connection health checks
βœ… Client nickname management
βœ… Server broadcasting and targeted messaging
βœ… Configurable limits (buffer size, timeouts, max connections, etc.)


βš™οΈ Configuration

Both the client and server use a FastNetworkConfig object to control behavior.

Example Configuration

var config = new FastNetworkConfig
{
    Protocol = ProtocolType.TCP,
    UseAES = true,
    AESKey = "your-256-bit-key",
    UseSSL = false,
    AutoReconnect = true,
    HeartbeatIntervalMs = 5000,
    ReconnectDelayMs = 3000,
    MaxReconnectAttempts = 5,
    TimeoutMs = 10000,
    BufferSize = 4096
};

πŸ’» Usage:

🀩 Server Example

using EonaCat.FastNetwork;
using EonaCat.FastNetwork.Models;
using System;
using System.Text;

class Program
{
    static async Task Main()
    {
        var config = new FastNetworkConfig
        {
            Protocol = ProtocolType.TCP,
            UseAES = true,
            AESKey = "your-256-bit-key",
            AutoReconnect = true
        };

        var server = new FastNetworkServer(config);

        server.ClientConnected += (s, info) =>
        {
            Console.WriteLine($"Client connected: {info.Id} ({info.RemoteEndPoint})");
        };

        server.MessageReceived += async (s, msg) =>
        {
            Console.WriteLine($"Message from {msg.SenderId}: {Encoding.UTF8.GetString(msg.Data)}");
            await server.SendToClientAsync(msg.SenderId, Encoding.UTF8.GetBytes("Message received!"));
        };

        server.ClientDisconnected += (s, info) =>
        {
            Console.WriteLine($"Client disconnected: {info.Id}");
        };

        await server.StartAsync(5000);
        Console.WriteLine("Server running on port 5000...");
        Console.ReadLine();
    }
}

πŸ˜‹ Client Example

using EonaCat.FastNetwork;
using EonaCat.FastNetwork.Models;
using System;
using System.Text;

class Program
{
    static async Task Main()
    {
        var config = new FastNetworkConfig
        {
            Protocol = ProtocolType.TCP,
            UseAES = true,
            AESKey = "your-256-bit-key",
            AutoReconnect = true
        };

        var client = new FastNetworkClient(config);

        client.StateChanged += (s, state) =>
        {
            Console.WriteLine($"Client state: {state}");
        };

        client.MessageReceived += (s, data) =>
        {
            Console.WriteLine($"Received: {Encoding.UTF8.GetString(data)}");
        };

        await client.ConnectAsync("127.0.0.1", 5000);
        Console.WriteLine("Connected to server.");

        await client.SendAsync(Encoding.UTF8.GetBytes("Hello Server!"));
        Console.ReadLine();
    }
}

πŸ”’ Security Options

πŸ¦β€πŸ”₯AES Encryption

Enable AES encryption by setting:

config.UseAES = true;
config.AESKey = "your-256-bit-secret-key";

πŸ¦…SSL/TLS

Enable SSL by providing a certificate:

config.UseSSL = true;
config.Certificates = new[] { yourX509Certificate };

πŸ” Auto-Reconnect & Heartbeat

The client will automatically attempt to reconnect if the connection fails, if AutoReconnect = true.

The server uses heartbeats and timeouts to monitor inactive clients and disconnect them.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  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. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.1

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 119 10/26/2025

A **lightweight, asynchronous, and secure networking framework** for C# that provides TCP and UDP client-server communication with built-in **AES encryption**, **SSL/TLS support**, **auto-reconnection**, and **heartbeat monitoring**.