ThreeByte.LinkLib.TcpLink 1.1.5

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

Asynchronous TCP client with automatic reconnection, message queuing, and thread-safe operation.

NuGet .NET


✨ Features

Feature Description
🔄 Auto-Reconnect Automatically re-establishes connections with a 3-second retry on failure
📦 Message Queuing Incoming data is queued (FIFO, up to 100 messages) for reliable retrieval
🔒 Thread-Safe All operations are protected with locking for concurrent access
Fully Async Uses BeginConnect / BeginRead / BeginWrite for non-blocking I/O
🔔 Event-Driven Rich event model for connection changes, data arrival, and errors
🎛️ Enable/Disable Pause and resume communication without destroying the connection

📦 Installation

dotnet add package ThreeByte.LinkLib.TcpLink

or via the NuGet Package Manager:

Install-Package ThreeByte.LinkLib.TcpLink

🚀 Quick Start

using ThreeByte.LinkLib.TcpLink;

// Create a TCP link to a remote device
var tcp = new AsyncTcpLink("192.168.1.100", 5000);

// Subscribe to events
tcp.IsConnectedChanged += (s, connected) =>
    Console.WriteLine(connected ? "✅ Connected" : "❌ Disconnected");

tcp.DataReceived += (s, e) =>
    Console.WriteLine($"Data arrived: {tcp.GetMessage()?.Length} bytes");

tcp.ErrorOccurred += (s, ex) =>
    Console.WriteLine($"Error: {ex.Message}");

// Send a message
byte[] command = System.Text.Encoding.ASCII.GetBytes("HELLO\r\n");
tcp.SendMessage(command);

// Retrieve queued incoming data
if (tcp.HasData)
{
    byte[]? response = tcp.GetMessage();
}

// Clean up
tcp.Dispose();

📖 API Reference

Constructors
AsyncTcpLink(string address, int port)
AsyncTcpLink(string address, int port, bool enabled = true)
Properties
Property Type Description
IsConnected bool Whether the TCP socket is currently connected
IsEnabled bool Whether messaging is active
Address string Remote host address
Port int Remote host port
HasData bool Whether there are queued incoming messages
Methods
Method Returns Description
SendMessage(byte[]) void Sends a byte array to the remote host
GetMessage() byte[]? Dequeues and returns the next incoming message (FIFO)
SetEnabled(bool) void Enables or disables communication
Dispose() void Releases all resources and closes the connection
Events
Event Args Description
IsConnectedChanged bool Fires when connection state changes
IsEnabledChanged bool Fires when enabled state changes
ErrorOccurred Exception Fires on communication errors
DataReceived EventArgs Fires when new data arrives

🔧 Configuration

Use TcpLinkSettings for structured configuration:

var settings = new TcpLinkSettings("192.168.1.100", 5000);
// Access settings.Address, settings.Port

🏗️ Architecture

┌─────────────────────────────────────────────┐
│              AsyncTcpLink                   │
│                                             │
│  ┌───────────┐  ┌───────────┐  ┌─────────┐ │
│  │  Connect   │  │   Read    │  │  Write  │ │
│  │  (Async)   │  │  (Async)  │  │ (Async) │ │
│  └─────┬─────┘  └─────┬─────┘  └────┬────┘ │
│        │              │              │      │
│        ▼              ▼              ▼      │
│  ┌─────────────────────────────────────────┐│
│  │         Thread-Safe Message Queue       ││
│  │            (FIFO, max 100)              ││
│  └─────────────────────────────────────────┘│
│        │                                    │
│        ▼                                    │
│  ┌─────────────────────────────────────────┐│
│  │     Auto-Reconnect Timer (3 sec)        ││
│  └─────────────────────────────────────────┘│
└─────────────────────────────────────────────┘

🎯 Platform Support

Platform Supported
.NET 10.0
.NET Standard 2.1
.NET Standard 2.0
Windows
Linux
macOS

📄 License

Part of the ThreeByte.LinkLib family of communication libraries.

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 is compatible.  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 netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  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.

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.1.5 24 3/25/2026
1.1.4 38 3/25/2026
1.1.3 357 12/24/2025
1.1.2 873 7/9/2025
1.1.1 178 7/9/2025
1.1.0 258 5/6/2025
1.0.3 866 3/26/2025
1.0.2 125 3/15/2025
1.0.1 261 3/4/2025
1.0.0 159 2/15/2025