Rat (Release Audit Tool) resultsThe following document contains the results of Rat (Release Audit Tool). ***************************************************** Summary ------- Generated at: 2024-11-04T19:03:34+01:00 Notes: 2 Binaries: 3 Archives: 0 Standards: 337 Apache Licensed: 335 Generated Documents: 0 JavaDocs are generated, thus a license header is optional. Generated files do not require license headers. 2 Unknown Licenses ***************************************************** Files with unapproved licenses: src/log4net.globalconfig src/log4net.Tests/Appender/Internal/SimpleTelnetClient.cs ***************************************************** ***************************************************** Files with Apache License headers will be marked AL Binary files (which do not require any license headers) will be marked B Compressed archives will be marked A Notices, licenses etc. will be marked N AL Dockerfile AL examples/Appenders/SampleAppendersApp/Appender/AsyncAppender.cs AL examples/Appenders/SampleAppendersApp/Appender/FireEventAppender.cs AL examples/Appenders/SampleAppendersApp/Appender/MessageBoxAppender.cs AL examples/Appenders/SampleAppendersApp/Appender/MessageObjectExpanderAppender.cs AL examples/Appenders/SampleAppendersApp/Appender/PatternFileAppender.cs AL examples/Appenders/SampleAppendersApp/Appender/PatternLayoutAdoNetAppender.cs AL examples/Appenders/SampleAppendersApp/Appender/PatternLayoutAdoNetAppenderParameter.cs AL examples/Appenders/SampleAppendersApp/LoggingExample.cs AL examples/Appenders/WmiAppender/IWmiBoundEvent.cs AL examples/Appenders/WmiAppender/WmiAppender.cs AL examples/Appenders/WmiAppender/WmiInstaller.cs AL examples/Appenders/WmiAppender/WmiLayout.cs AL examples/Appenders/WmiAppender/WmiLoggingEvent.cs AL examples/Extensibility/EventIDLogApp/EventIDLogApp.cs AL examples/Extensibility/TraceLogApp/TraceLogApp.cs AL examples/Extensions/log4net.Ext.EventID/EventIDLogImpl.cs AL examples/Extensions/log4net.Ext.EventID/EventIDLogManager.cs AL examples/Extensions/log4net.Ext.EventID/IEventIDLog.cs AL examples/Extensions/log4net.Ext.MarshalByRef/AssemblyInfo.cs AL examples/Extensions/log4net.Ext.MarshalByRef/MarshalByRefLogImpl.cs AL examples/Extensions/log4net.Ext.MarshalByRef/MarshalByRefLogManager.cs AL examples/Extensions/log4net.Ext.Trace/ITraceLog.cs AL examples/Extensions/log4net.Ext.Trace/TraceLogImpl.cs AL examples/Extensions/log4net.Ext.Trace/TraceLogManager.cs AL examples/Layouts/SampleLayoutsApp/Layout/ForwardingLayout.cs AL examples/Layouts/SampleLayoutsApp/Layout/LevelConversionPattern.cs AL examples/Layouts/SampleLayoutsApp/Layout/LevelPatternLayout.cs AL examples/Layouts/SampleLayoutsApp/Layout/LineWrappingLayout.cs AL examples/Layouts/SampleLayoutsApp/LoggingExample.cs AL examples/Performance/NotLogging/NotLogging.cs AL examples/Tutorials/ConsoleApp/LoggingExample.cs N LICENSE AL local-tasks/build-site.js B local-tasks/default-tools-installer.ts AL local-tasks/hash-build-artifacts.js AL local-tasks/prefix-build-artifacts.js AL local-tasks/prepare-build-artifacts.js B local-tasks/update-version-info.ts AL local-tasks/zip.js N NOTICE B package-icon.png AL src/log4net/Appender/AdoNetAppender.cs AL src/log4net/Appender/AnsiColorTerminalAppender.cs AL src/log4net/Appender/AppenderCollection.cs AL src/log4net/Appender/AppenderSkeleton.cs AL src/log4net/Appender/AspNetTraceAppender.cs AL src/log4net/Appender/BufferingAppenderSkeleton.cs AL src/log4net/Appender/BufferingForwardingAppender.cs AL src/log4net/Appender/ColoredConsoleAppender.cs AL src/log4net/Appender/ConsoleAppender.cs AL src/log4net/Appender/DebugAppender.cs AL src/log4net/Appender/EventLogAppender.cs AL src/log4net/Appender/FileAppender.cs AL src/log4net/Appender/ForwardingAppender.cs AL src/log4net/Appender/IAppender.cs AL src/log4net/Appender/IBulkAppender.cs AL src/log4net/Appender/IFlushable.cs AL src/log4net/Appender/LocalSyslogAppender.cs AL src/log4net/Appender/ManagedColoredConsoleAppender.cs AL src/log4net/Appender/MemoryAppender.cs AL src/log4net/Appender/OutputDebugStringAppender.cs AL src/log4net/Appender/RemoteSyslogAppender.cs AL src/log4net/Appender/RollingFileAppender.cs AL src/log4net/Appender/RollingFileAppender.DateTime.cs AL src/log4net/Appender/SmtpAppender.cs AL src/log4net/Appender/SmtpPickupDirAppender.cs AL src/log4net/Appender/TelnetAppender.cs AL src/log4net/Appender/TextWriterAppender.cs AL src/log4net/Appender/TraceAppender.cs AL src/log4net/Appender/UdpAppender.cs AL src/log4net/AssemblyInfo.cs AL src/log4net/Config/AliasRepositoryAttribute.cs AL src/log4net/Config/BasicConfigurator.cs AL src/log4net/Config/ConfiguratorAttribute.cs AL src/log4net/Config/Log4NetConfigurationSectionHandler.cs AL src/log4net/Config/PluginAttribute.cs AL src/log4net/Config/RepositoryAttribute.cs AL src/log4net/Config/SecurityContextProviderAttribute.cs AL src/log4net/Config/XmlConfigurator.cs AL src/log4net/Config/XmlConfiguratorAttribute.cs AL src/log4net/Core/DefaultRepositorySelector.cs AL src/log4net/Core/ErrorCode.cs AL src/log4net/Core/ExceptionEvaluator.cs AL src/log4net/Core/FixFlags.cs AL src/log4net/Core/IAppenderAttachable.cs AL src/log4net/Core/IErrorHandler.cs AL src/log4net/Core/IFixingRequired.cs AL src/log4net/Core/ILogger.cs AL src/log4net/Core/ILoggerWrapper.cs AL src/log4net/Core/IOptionHandler.cs AL src/log4net/Core/IRepositorySelector.cs AL src/log4net/Core/ITriggeringEventEvaluator.cs AL src/log4net/Core/Level.cs AL src/log4net/Core/LevelCollection.cs AL src/log4net/Core/LevelEvaluator.cs AL src/log4net/Core/LevelMap.cs AL src/log4net/Core/LocationInfo.cs AL src/log4net/Core/LogException.cs AL src/log4net/Core/LoggerManager.cs AL src/log4net/Core/LoggerWrapperImpl.cs AL src/log4net/Core/LoggingEvent.cs AL src/log4net/Core/LogImpl.cs AL src/log4net/Core/MethodItem.cs AL src/log4net/Core/SecurityContext.cs AL src/log4net/Core/SecurityContextProvider.cs AL src/log4net/Core/Serializable.cs AL src/log4net/Core/StackFrameItem.cs AL src/log4net/Core/TimeEvaluator.cs AL src/log4net/Core/WrapperMap.cs AL src/log4net/DateFormatter/AbsoluteTimeDateFormatter.cs AL src/log4net/DateFormatter/DateTimeDateFormatter.cs AL src/log4net/DateFormatter/IDateFormatter.cs AL src/log4net/DateFormatter/Iso8601DateFormatter.cs AL src/log4net/DateFormatter/SimpleDateFormatter.cs AL src/log4net/Diagnostics/CodeAnalysis/AllowNullAttribute.cs AL src/log4net/Diagnostics/CodeAnalysis/CallerArgumentExpressionAttribute.cs AL src/log4net/Diagnostics/CodeAnalysis/CompilerFeatureRequiredAttribute.cs AL src/log4net/Diagnostics/CodeAnalysis/DisallowNullAttribute.cs AL src/log4net/Diagnostics/CodeAnalysis/DoesNotReturnAttribute.cs AL src/log4net/Diagnostics/CodeAnalysis/DoesNotReturnIfAttribute.cs AL src/log4net/Diagnostics/CodeAnalysis/IsExternalInit.cs AL src/log4net/Diagnostics/CodeAnalysis/MaybeNullAttribute.cs AL src/log4net/Diagnostics/CodeAnalysis/MaybeNullWhenAttribute.cs AL src/log4net/Diagnostics/CodeAnalysis/MemberNotNullAttribute.cs AL src/log4net/Diagnostics/CodeAnalysis/MemberNotNullWhenAttribute.cs AL src/log4net/Diagnostics/CodeAnalysis/NotNullAttribute.cs AL src/log4net/Diagnostics/CodeAnalysis/NotNullIfNotNullAttribute.cs AL src/log4net/Diagnostics/CodeAnalysis/NotNullWhenAttribute.cs AL src/log4net/Diagnostics/CodeAnalysis/NullableAttribute.cs AL src/log4net/Diagnostics/CodeAnalysis/NullableContextAttribute.cs AL src/log4net/Diagnostics/CodeAnalysis/RequiredMemberAttribute.cs AL src/log4net/Diagnostics/CodeAnalysis/SetsRequiredMembersAttribute.cs AL src/log4net/Diagnostics/CodeAnalysis/ValidatedNotNullAttribute.cs AL src/log4net/Filter/DenyAllFilter.cs AL src/log4net/Filter/FilterDecision.cs AL src/log4net/Filter/FilterSkeleton.cs AL src/log4net/Filter/IFilter.cs AL src/log4net/Filter/LevelMatchFilter.cs AL src/log4net/Filter/LevelRangeFilter.cs AL src/log4net/Filter/LoggerMatchFilter.cs AL src/log4net/Filter/MdcFilter.cs AL src/log4net/Filter/NdcFilter.cs AL src/log4net/Filter/PropertyFilter.cs AL src/log4net/Filter/StringMatchFilter.cs AL src/log4net/GlobalContext.cs AL src/log4net/ILog.cs AL src/log4net/Layout/DynamicPatternLayout.cs AL src/log4net/Layout/ExceptionLayout.cs AL src/log4net/Layout/ILayout.cs AL src/log4net/Layout/Internal/XmlWriterExtensions.cs AL src/log4net/Layout/IRawLayout.cs AL src/log4net/Layout/Layout2RawLayoutAdapter.cs AL src/log4net/Layout/LayoutSkeleton.cs AL src/log4net/Layout/Pattern/AppDomainPatternConverter.cs AL src/log4net/Layout/Pattern/AspNetCachePatternConverter.cs AL src/log4net/Layout/Pattern/AspNetContextPatternConverter.cs AL src/log4net/Layout/Pattern/AspNetPatternConverter.cs AL src/log4net/Layout/Pattern/AspNetRequestPatternConverter.cs AL src/log4net/Layout/Pattern/AspNetSessionPatternConverter.cs AL src/log4net/Layout/Pattern/DatePatternConverter.cs AL src/log4net/Layout/Pattern/ExceptionPatternConverter.cs AL src/log4net/Layout/Pattern/FileLocationPatternConverter.cs AL src/log4net/Layout/Pattern/FullLocationPatternConverter.cs AL src/log4net/Layout/Pattern/IdentityPatternConverter.cs AL src/log4net/Layout/Pattern/LevelPatternConverter.cs AL src/log4net/Layout/Pattern/LineLocationPatternConverter.cs AL src/log4net/Layout/Pattern/LoggerPatternConverter.cs AL src/log4net/Layout/Pattern/MessagePatternConverter.cs AL src/log4net/Layout/Pattern/MethodLocationPatternConverter.cs AL src/log4net/Layout/Pattern/NamedPatternConverter.cs AL src/log4net/Layout/Pattern/NdcPatternConverter.cs AL src/log4net/Layout/Pattern/PatternLayoutConverter.cs AL src/log4net/Layout/Pattern/PropertyPatternConverter.cs AL src/log4net/Layout/Pattern/RelativeTimePatternConverter.cs AL src/log4net/Layout/Pattern/StackTraceDetailPatternConverter.cs AL src/log4net/Layout/Pattern/StackTracePatternConverter.cs AL src/log4net/Layout/Pattern/ThreadPatternConverter.cs AL src/log4net/Layout/Pattern/TypeNamePatternConverter.cs AL src/log4net/Layout/Pattern/UserNamePatternConverter.cs AL src/log4net/Layout/Pattern/UtcDatePatternConverter.cs AL src/log4net/Layout/PatternLayout.cs AL src/log4net/Layout/RawLayoutConverter.cs AL src/log4net/Layout/RawPropertyLayout.cs AL src/log4net/Layout/RawTimeStampLayout.cs AL src/log4net/Layout/RawUtcTimeStampLayout.cs AL src/log4net/Layout/SimpleLayout.cs AL src/log4net/Layout/XmlLayout.cs AL src/log4net/Layout/XmlLayoutBase.cs AL src/log4net/Layout/XmlLayoutSchemaLog4j.cs AL src/log4net/LogicalThreadContext.cs AL src/log4net/LogManager.cs AL src/log4net/MDC.cs AL src/log4net/NDC.cs AL src/log4net/ObjectRenderer/DefaultRenderer.cs AL src/log4net/ObjectRenderer/IObjectRenderer.cs AL src/log4net/ObjectRenderer/RendererMap.cs AL src/log4net/Plugin/IPlugin.cs AL src/log4net/Plugin/IPluginFactory.cs AL src/log4net/Plugin/PluginCollection.cs AL src/log4net/Plugin/PluginMap.cs AL src/log4net/Plugin/PluginSkeleton.cs AL src/log4net/Repository/ConfigurationChangedEventArgs.cs AL src/log4net/Repository/Hierarchy/DefaultLoggerFactory.cs AL src/log4net/Repository/Hierarchy/Hierarchy.cs AL src/log4net/Repository/Hierarchy/ILoggerFactory.cs AL src/log4net/Repository/Hierarchy/Logger.cs AL src/log4net/Repository/Hierarchy/LoggerKey.cs AL src/log4net/Repository/Hierarchy/ProvisionNode.cs AL src/log4net/Repository/Hierarchy/RootLogger.cs AL src/log4net/Repository/Hierarchy/XmlHierarchyConfigurator.cs AL src/log4net/Repository/IBasicRepositoryConfigurator.cs AL src/log4net/Repository/ILoggerRepository.cs AL src/log4net/Repository/IXmlRepositoryConfigurator.cs AL src/log4net/Repository/LoggerRepositorySkeleton.cs AL src/log4net/ThreadContext.cs AL src/log4net/Util/AppenderAttachedImpl.cs AL src/log4net/Util/CompositeProperties.cs AL src/log4net/Util/ContextPropertiesBase.cs AL src/log4net/Util/ConverterInfo.cs AL src/log4net/Util/CountingQuietTextWriter.cs AL src/log4net/Util/CyclicBuffer.cs AL src/log4net/Util/EmptyCollection.cs AL src/log4net/Util/EmptyDictionary.cs AL src/log4net/Util/EncodingWithoutPreamble.cs AL src/log4net/Util/FormattingInfo.cs AL src/log4net/Util/GlobalContextProperties.cs AL src/log4net/Util/ILogExtensions.cs AL src/log4net/Util/LevelMapping.cs AL src/log4net/Util/LevelMappingEntry.cs AL src/log4net/Util/Log4NetAssert.cs AL src/log4net/Util/LogicalThreadContextProperties.cs AL src/log4net/Util/LogicalThreadContextStack.cs AL src/log4net/Util/LogicalThreadContextStacks.cs AL src/log4net/Util/LogLog.cs AL src/log4net/Util/NativeError.cs AL src/log4net/Util/NativeMethods.cs AL src/log4net/Util/NullDictionaryEnumerator.cs AL src/log4net/Util/NullEnumerator.cs AL src/log4net/Util/NullSecurityContext.cs AL src/log4net/Util/OnlyOnceErrorHandler.cs AL src/log4net/Util/OptionConverter.cs AL src/log4net/Util/PatternConverter.cs AL src/log4net/Util/PatternParser.cs AL src/log4net/Util/PatternString.cs AL src/log4net/Util/PatternStringConverters/AppDomainPatternConverter.cs AL src/log4net/Util/PatternStringConverters/AppSettingPatternConverter.cs AL src/log4net/Util/PatternStringConverters/DatePatternConverter.cs AL src/log4net/Util/PatternStringConverters/EnvironmentFolderPathPatternConverter.cs AL src/log4net/Util/PatternStringConverters/EnvironmentPatternConverter.cs AL src/log4net/Util/PatternStringConverters/IdentityPatternConverter.cs AL src/log4net/Util/PatternStringConverters/LiteralPatternConverter.cs AL src/log4net/Util/PatternStringConverters/NewLinePatternConverter.cs AL src/log4net/Util/PatternStringConverters/ProcessIdPatternConverter.cs AL src/log4net/Util/PatternStringConverters/PropertyPatternConverter.cs AL src/log4net/Util/PatternStringConverters/RandomStringPatternConverter.cs AL src/log4net/Util/PatternStringConverters/UserNamePatternConverter.cs AL src/log4net/Util/PatternStringConverters/UtcDatePatternConverter.cs AL src/log4net/Util/PropertiesDictionary.cs AL src/log4net/Util/PropertyEntry.cs AL src/log4net/Util/ProtectCloseTextWriter.cs AL src/log4net/Util/QuietTextWriter.cs AL src/log4net/Util/ReaderWriterLock.cs AL src/log4net/Util/ReadOnlyPropertiesDictionary.cs AL src/log4net/Util/ReusableStringWriter.cs AL src/log4net/Util/SystemInfo.cs AL src/log4net/Util/SystemStringFormat.cs AL src/log4net/Util/TextWriterAdapter.cs AL src/log4net/Util/ThreadContextProperties.cs AL src/log4net/Util/ThreadContextStack.cs AL src/log4net/Util/ThreadContextStacks.cs AL src/log4net/Util/Transform.cs AL src/log4net/Util/TypeConverters/BooleanConverter.cs AL src/log4net/Util/TypeConverters/ConversionNotSupportedException.cs AL src/log4net/Util/TypeConverters/ConverterRegistry.cs AL src/log4net/Util/TypeConverters/EncodingConverter.cs AL src/log4net/Util/TypeConverters/IConvertFrom.cs AL src/log4net/Util/TypeConverters/IConvertTo.cs AL src/log4net/Util/TypeConverters/IPAddressConverter.cs AL src/log4net/Util/TypeConverters/PatternLayoutConverter.cs AL src/log4net/Util/TypeConverters/PatternStringConverter.cs AL src/log4net/Util/TypeConverters/TypeConverter.cs AL src/log4net/Util/TypeConverters/TypeConverterAttribute.cs AL src/log4net/Util/WindowsSecurityContext.cs !????? src/log4net.globalconfig AL src/log4net.Tests/Appender/AdoNet/Log4NetCommand.cs AL src/log4net.Tests/Appender/AdoNet/Log4NetConnection.cs AL src/log4net.Tests/Appender/AdoNet/Log4NetParameter.cs AL src/log4net.Tests/Appender/AdoNet/Log4NetParameterCollection.cs AL src/log4net.Tests/Appender/AdoNet/Log4NetTransaction.cs AL src/log4net.Tests/Appender/AdoNetAppenderTest.cs AL src/log4net.Tests/Appender/AppenderCollectionTest.cs AL src/log4net.Tests/Appender/BufferingAppenderTest.cs AL src/log4net.Tests/Appender/CountingAppender.cs AL src/log4net.Tests/Appender/DebugAppenderTest.cs AL src/log4net.Tests/Appender/EventLogAppenderTest.cs AL src/log4net.Tests/Appender/EventRaisingAppender.cs AL src/log4net.Tests/Appender/FileAppenderTest.cs !????? src/log4net.Tests/Appender/Internal/SimpleTelnetClient.cs AL src/log4net.Tests/Appender/MemoryAppenderTest.cs AL src/log4net.Tests/Appender/RecursiveLoggingTest.cs AL src/log4net.Tests/Appender/RollingFileAppenderTest.cs AL src/log4net.Tests/Appender/SmtpPickupDirAppenderTest.cs AL src/log4net.Tests/Appender/StringAppender.cs AL src/log4net.Tests/Appender/TelnetAppenderTest.cs AL src/log4net.Tests/Appender/TraceAppenderTest.cs AL src/log4net.Tests/AssemblyInfo.cs AL src/log4net.Tests/Context/LogicalThreadContextTest.cs AL src/log4net.Tests/Context/ThreadContextTest.cs AL src/log4net.Tests/Core/DefaultRepositorySelectorTest.cs AL src/log4net.Tests/Core/EvaluatorTest.cs AL src/log4net.Tests/Core/FixingTest.cs AL src/log4net.Tests/Core/LevelMappingTest.cs AL src/log4net.Tests/Core/LevelMapTest.cs AL src/log4net.Tests/Core/LevelTest.cs AL src/log4net.Tests/Core/LoggingEventTest.cs AL src/log4net.Tests/Core/ShutdownTest.cs AL src/log4net.Tests/Core/StringFormatTest.cs AL src/log4net.Tests/DateFormatter/AbsoluteTimeDateFormatterTest.cs AL src/log4net.Tests/DateFormatter/DateTimeDateFormatterTest.cs AL src/log4net.Tests/Filter/FilterTest.cs AL src/log4net.Tests/Hierarchy/HierarchyTest.cs AL src/log4net.Tests/Hierarchy/LoggerTest.cs AL src/log4net.Tests/Hierarchy/XmlHierarchyConfiguratorTest.cs AL src/log4net.Tests/Layout/DynamicPatternLayoutTest.cs AL src/log4net.Tests/Layout/PatternLayoutTest.cs AL src/log4net.Tests/Layout/XmlLayoutTest.cs AL src/log4net.Tests/LoggerRepository/ConfigurationMessages.cs AL src/log4net.Tests/NUnitTestRunnerInitializer.cs AL src/log4net.Tests/ObjectRenderer/DefaultRendererTest.cs AL src/log4net.Tests/Signing.cs AL src/log4net.Tests/Util/CyclicBufferTest.cs AL src/log4net.Tests/Util/EncodingWithoutPreambleTest.cs AL src/log4net.Tests/Util/EnvironmentPatternConverterTest.cs AL src/log4net.Tests/Util/LogLogTest.cs AL src/log4net.Tests/Util/PatternConverterTest.cs AL src/log4net.Tests/Util/PatternStringTest.cs AL src/log4net.Tests/Util/PropertiesDictionaryTest.cs AL src/log4net.Tests/Util/RandomStringPatternConverterTest.cs AL src/log4net.Tests/Util/SystemInfoTest.cs AL src/log4net.Tests/Util/TransformTest.cs AL src/log4net.Tests/Utils.cs ***************************************************** Printing headers for text files without a valid license header... ===================================================== == File: src/log4net.globalconfig ===================================================== # https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/configuration-files # global can be overridden by local is_global = true # higher levels override lower levels. Standard is 0. MS-Analyzer are -100 global_level = -30 # --- # https://github.com/dotnet/roslyn-analyzers/issues/7031 #CA2021: Type '{}' is incompatible with type '{}' and cast attempts will throw InvalidCastException at runtime dotnet_diagnostic.CA2021.severity = none # --- #CA1002: Do not expose generic lists dotnet_diagnostic.CA1002.severity = warning #CA1003: Use generic event handler instances dotnet_diagnostic.CA1003.severity = warning #CA1005: Avoid excessive parameters on generic types dotnet_diagnostic.CA1005.severity = warning #CA1008: Enums should have zero value dotnet_diagnostic.CA1008.severity = warning #CA1012: Abstract types should not have constructors dotnet_diagnostic.CA1012.severity = warning #CA1019: Define accessors for attribute arguments dotnet_diagnostic.CA1019.severity = warning #CA1024: Use properties where appropriate dotnet_diagnostic.CA1024.severity = warning #CA1027: Mark enums with FlagsAttribute dotnet_diagnostic.CA1027.severity = warning #CA1031: Do not catch general exception types dotnet_diagnostic.CA1031.severity = warning #CA1040: Avoid empty interfaces dotnet_diagnostic.CA1040.severity = warning #CA1043: Use integral or string argument for indexers dotnet_diagnostic.CA1043.severity = warning #CA1044: Properties should not be write only dotnet_diagnostic.CA1044.severity = warning ===================================================== == File: src/log4net.Tests/Appender/Internal/SimpleTelnetClient.cs ===================================================== using System; using System.Net; using System.Net.Sockets; using System.Threading; using System.Threading.Tasks; namespace log4net.Tests.Appender.Internal; /// <summary> /// Telnet Client for unit testing /// </summary> /// <param name="received">Callback for received messages</param> /// <param name="port">TCP-Port to use</param> internal sealed class SimpleTelnetClient( Action<string> received, int port) : IDisposable { private readonly CancellationTokenSource _cancellationTokenSource = new(); private readonly TcpClient _client = new(); /// <summary> /// Runs the client (in a task) /// </summary> internal void Run() => Task.Run(() => { _client.Connect(new IPEndPoint(IPAddress.Loopback, port)); // Get a stream object for reading and writing using NetworkStream stream = _client.GetStream(); int i; byte[] bytes = new byte[256]; // Loop to receive all the data sent by the server while ((i = stream.Read(bytes, 0, bytes.Length)) != 0) { string data = System.Text.Encoding.ASCII.GetString(bytes, 0, i); received(data); if (_cancellationTokenSource.Token.IsCancellationRequested) { return; } } }, _cancellationTokenSource.Token); /// <inheritdoc/> public void Dispose() { _cancellationTokenSource.Cancel(); _cancellationTokenSource.Dispose(); _client.Dispose(); } |