Beckhoff.TwinCAT.Ads.TcpRouter 5.0.0-preview1

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
This is a prerelease version of Beckhoff.TwinCAT.Ads.TcpRouter.
There is a newer version of this package available.
See the version list below for details.
The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package Beckhoff.TwinCAT.Ads.TcpRouter --version 5.0.0-preview1
NuGet\Install-Package Beckhoff.TwinCAT.Ads.TcpRouter -Version 5.0.0-preview1
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="Beckhoff.TwinCAT.Ads.TcpRouter" Version="5.0.0-preview1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Beckhoff.TwinCAT.Ads.TcpRouter --version 5.0.0-preview1
#r "nuget: Beckhoff.TwinCAT.Ads.TcpRouter, 5.0.0-preview1"
#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.
// Install Beckhoff.TwinCAT.Ads.TcpRouter as a Cake Addin
#addin nuget:?package=Beckhoff.TwinCAT.Ads.TcpRouter&version=5.0.0-preview1&prerelease

// Install Beckhoff.TwinCAT.Ads.TcpRouter as a Cake Tool
#tool nuget:?package=Beckhoff.TwinCAT.Ads.TcpRouter&version=5.0.0-preview1&prerelease

Description

The package 'Beckhoff.TwinCAT.Ads.TcpRouter' implements a lean TCP ADS Router class to use on systems where no standard TwinCAT router is established or available.

It is running in UserMode only (no realtime characteristics) and contains no further functionality than distributing the ADS Frames (e.g. no Port 10000, no ADS Secure). It is just used to route ADS frames locally between AdsServers and to/from remote ADS devices.

Implemented in asynchronous .NET Code it can be run in your own services/daemon, as standalone console application and also in your customized application.

Requirements

  • .NET Core 3.0, .NET Framework 4.8 or .NET Standard 2.0 compatible SDK (included in VS2019 16.3)
  • No other System allocating the same port (e.g. a regular TwinCAT installation)
  • Installed Nuget package manager or Dotnet CLI

Installation

Together with the package deployment, there comes a "StaticRoutes.xml" file. This file is loaded by the 'TwinCAT.Ads.TcpRouter.AmsTcpIpRouter' class and must contain the Local AmsNetId (can be chosen, but must be unique) and the RemoteConnections that will be available from the outside.

An example of the local "StaticRoutes.xml" is given here:

<?xml version="1.0" encoding="utf-8"?>
<TcConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="C:\TwinCAT3\Config\TcConfig.xsd">
  <Local>
      <Name>MyLocalSystem</Name>
      <NetId>192.168.1.22.1.1</NetId> 
  </Local>
  <RemoteConnections>
    <Route>
      <Name>MyRemoteSystem</Name>
      <Address>RemoteSytem</Address> 
       
      <NetId>192.168.1.21.1.1</NetId>
      <Type>TCP_IP</Type>
    </Route>
  </RemoteConnections>
</TcConfig>

This file must be edited to configure the ADS Router. It is not reloaded during the runtime of the 'TwinCAT.Ads.TcpRouter.AmsTcpIpRouter' class.

To enable ADS Communication, the following settings have to be made:

  • Select the Local AmsNetId and the Route Name of the System in the local "StaticRoutes.xml"
  • Add Remote Connections to the local StaticRoutes
  • Add the "Backroute" from the Remote system linking to the our system (via AmsNETId) running the AdsRouteConsole. This can be done via SystemManager / SystemService System Tray or 'StaticRoutes.xml' on the remote systems.

First Steps

Example of starting the TcpIpRouter from a simple Console application with logging.

using System;
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using TwinCAT.Ads.TcpRouter;

namespace TwinCAT.Ads.AdsRouterConsole
{
    class Program
    {
        static void Main(string[] args)
        {
            // Run the TcpIP Router on a background thread.
            Task.Run(async () =>
                {
                    try
                    {
                        await MainAsync(args);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine("Error: " + ex.Message);
                    }
                }
            );

            Console.WriteLine("Press Enter to stop Server");
            Console.ReadLine();
            Console.WriteLine("Stopping!");
            StopMain();
            Console.WriteLine("Server Stopped! Enter to exit.");
            Console.ReadLine();
        }

        /// <summary>
        /// The router object
        /// </summary>
        static AmsTcpIpRouter s_router = null;

        /// <summary>
        /// Cancellation source
        /// </summary>
        static CancellationTokenSource s_cancel = null;

        /// <summary>
        /// Async main method.
        /// </summary>
        /// <param name="args">Console arguments.</param>
        /// <returns>Task.</returns>
        public static async Task MainAsync(string[] args)
        {
            ILoggerFactory loggerFactory = LoggerFactory.Create(builder =>
            {
                builder.AddFilter("Microsoft", LogLevel.Warning)
                .AddFilter("System", LogLevel.Warning)
                .AddFilter("AdsServerCore.Program", LogLevel.Information)
                .AddConsole();
            }
            );

            ILogger logger = loggerFactory.CreateLogger("Router");
            // You must close or flush the trace to empty the output buffer.  
            Trace.Flush();
            s_cancel = new CancellationTokenSource();

            s_router = new AmsTcpIpRouter(logger);
            await s_router.StartAsync(); // Start the router
        }

        /// <summary>
        /// Stops the router.
        /// </summary>
        public static void StopMain()
        {
            s_router.Stop();
        }
    }
}
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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 is compatible.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 is compatible.  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 (2)

Showing the top 2 NuGet packages that depend on Beckhoff.TwinCAT.Ads.TcpRouter:

Package Downloads
dsian.TwinCAT.Ads.Server.Mock

Mocking a TwinCAT Ads Server, for unit testing code with ADS read/write requests.

Beckhoff.TwinCAT.Ads.SystemServer The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

The Beckhoff.TwinCAT.Ads.SystemServer Package implements an TwinCAT System Service ADS Server (Port 10000) for usage in combination with the Beckhoff.TwinCAT.Ads.TcpRouter Package.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
6.1.203 2,455 3/15/2024
6.1.197 5,112 2/12/2024
6.1.154 6,203 12/8/2023
6.1.125 1,709 11/23/2023
6.0.356 834 2/12/2024
6.0.334 496 12/8/2023
6.0.322 132 11/23/2023

Beta version of the ADS Version 5.0.0 Version branch. Don't use for productive code.