https://github.com/bjorg/radiantpi.telnet
Client for Telnet connections
https://github.com/bjorg/radiantpi.telnet
Last synced: 10 months ago
JSON representation
Client for Telnet connections
- Host: GitHub
- URL: https://github.com/bjorg/radiantpi.telnet
- Owner: bjorg
- License: agpl-3.0
- Created: 2021-10-27T01:02:05.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-09-25T17:37:50.000Z (almost 3 years ago)
- Last Synced: 2025-06-08T04:47:27.594Z (about 1 year ago)
- Language: C#
- Size: 49.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: ReadMe.md
- License: LICENSE
Awesome Lists containing this project
README
# RadiantPi.Telnet
`TelnetClient` simplifies working with Telnet connections. The library is platform agnostic and works on Windows or Linux, including on a Raspberry Pi.
Run the `dotnet` command from your project folder to add the `RadiantPi.Telnet` assembly:
```
dotnet add package RadiantPi.Telnet
```
Find a description of the latest changes in the [release notes](ReleaseNotes.md).
## Sample: Hello Trinnov
Use `TelnetClient` to connect to an Trinnov Altitude processor.
```csharp
using System;
using RadiantPi.Telnet;
// initialize client
using TelnetClient client = new("192.168.1.180", 44100);
// register server connection validation
client.ValidateConnectionAsync = async (client, reader, writer) => {
var handshake = await reader.ReadLineAsync() ?? "";
// the Trinnov Altitude sends a welcome text to identify itself
if(!handshake.StartsWith("Welcome on Trinnov Optimizer (", StringComparison.Ordinal)) {
throw new NotSupportedException("Unrecognized device");
}
// announce client
await writer.WriteLineAsync("id radiant_pi_telnet");
};
client.MessageReceived += delegate (object? sender, TelnetMessageReceivedEventArgs args) {
Console.WriteLine($"Received: {args.Message}");
};
Console.WriteLine("Open connection");
await client.ConnectAsync();
Console.WriteLine("Press ENTER to exit.");
Console.ReadLine();
```
## License
This application is distributed under the GNU Affero General Public License v3.0 or later.
Copyright (C) 2020-2022 - Steve G. Bjorg