PlcComm.KvHostLink 0.1.4

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

CI NuGet Documentation .NET 9.0 License: MIT Static Analysis: dotnet format

Illustration

Modern .NET library for KEYENCE KV series PLCs using the Host Link (Upper Link) protocol.

This README intentionally covers the recommended high-level API only:

  • OpenAndConnectAsync
  • ReadTypedAsync
  • WriteTypedAsync
  • WriteBitInWordAsync
  • ReadNamedAsync
  • PollAsync
  • ReadWordsAsync
  • ReadDWordsAsync

Low-level token-oriented methods and protocol details are kept in maintainer documentation.

Key Features

  • Async-first .NET API
  • High-level typed read/write helpers
  • Mixed snapshots with ReadNamedAsync
  • Polling with PollAsync
  • Contiguous block helpers for ushort[] and uint[]
  • Hardware-verified against KV-7500

Quick Start

Installation

dotnet add package PlcComm.KvHostLink

Or add a package reference directly:

<PackageReference Include="PlcComm.KvHostLink" Version="0.1.4" />

You can also reference src/PlcComm.KvHostLink/PlcComm.KvHostLink.csproj directly during local development.

High-level example

using PlcComm.KvHostLink;

await using var client = await KvHostLinkClientExtensions.OpenAndConnectAsync(
    "192.168.250.100",
    8501);

ushort dm0 = (ushort)await client.ReadTypedAsync("DM0", "U");
await client.WriteTypedAsync("DM10", "U", dm0);

var snapshot = await client.ReadNamedAsync(
    new[] { "DM0", "DM1:S", "DM2:D", "DM4:F", "DM10.0" });

Console.WriteLine(string.Join(", ", snapshot.Select(kv => $"{kv.Key}={kv.Value}")));

Common Workflows

Typed block reads:

ushort[] words = await client.ReadWordsAsync("DM100", 10);
uint[] dwords = await client.ReadDWordsAsync("DM200", 4);

Bit-in-word update:

await client.WriteBitInWordAsync("DM50", bitIndex: 3, value: true);

Polling:

await foreach (var snapshot in client.PollAsync(
    new[] { "DM100", "DM101:L", "DM50.3" },
    TimeSpan.FromSeconds(1)))
{
    Console.WriteLine(snapshot["DM100"]);
}

Sample Projects

Buildable sample projects are under samples/:

  • PlcComm.KvHostLink.HighLevelSample
  • PlcComm.KvHostLink.BasicReadWriteSample
  • PlcComm.KvHostLink.NamedPollingSample

API and workflow to sample mapping:

API / workflow Primary sample Purpose
OpenAndConnectAsync, ReadTypedAsync, WriteTypedAsync, ReadWordsAsync, ReadDWordsAsync, WriteBitInWordAsync, ReadNamedAsync, PollAsync samples/PlcComm.KvHostLink.HighLevelSample/PlcComm.KvHostLink.HighLevelSample.csproj End-to-end walkthrough of the full helper surface
ReadTypedAsync, WriteTypedAsync, ReadWordsAsync, ReadDWordsAsync samples/PlcComm.KvHostLink.BasicReadWriteSample/PlcComm.KvHostLink.BasicReadWriteSample.csproj Focused typed and block-read example
ReadNamedAsync, WriteBitInWordAsync, PollAsync samples/PlcComm.KvHostLink.NamedPollingSample/PlcComm.KvHostLink.NamedPollingSample.csproj Mixed snapshot and monitoring example

Run examples:

dotnet run --project samples/PlcComm.KvHostLink.HighLevelSample -- 192.168.250.100 8501
dotnet run --project samples/PlcComm.KvHostLink.BasicReadWriteSample -- 192.168.250.100 8501
dotnet run --project samples/PlcComm.KvHostLink.NamedPollingSample -- 192.168.250.100 8501

Documentation

User documentation:

Maintainer and QA documentation:

Development and CI

run_ci.bat
release_check.bat

run_ci.bat builds the library, tests it, checks formatting, builds all user-facing sample projects, verifies XML docs coverage for the public high-level API, and checks sample references in the docs.

release_check.bat runs run_ci.bat and then rebuilds the published docs.

Pack the NuGet package locally:

dotnet pack src\PlcComm.KvHostLink\PlcComm.KvHostLink.csproj -c Release

License

Distributed under the MIT License.

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

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
0.1.4 131 3/28/2026
0.1.3 129 3/28/2026