ctelnet 0.1.2 copy "ctelnet: ^0.1.2" to clipboard
ctelnet: ^0.1.2 copied to clipboard

A simple Telnet client for Dart/Flutter, parse incoming and outgoing data easily and quickly.

example/example.dart

import 'dart:io';

import 'package:ctelnet/ctelnet.dart';

var env = Platform.environment;
final host = env['HOST'] ?? 'localhost';
final port = int.parse(env['PORT'] ?? '23');

void main(List<String> args) async {
  print('Connecting to $host:$port');

  final client = CTelnetClient(
    host: host,
    port: port,
    timeout: Duration(seconds: 30),
    onConnect: () => print('Connected'),
    onDisconnect: () => print('Disconnected'),
    onData: (data) {
      print('DBG:        ${data.toDebugString()}');
      print('toString(): ${data.toString()}');
      print('.text:      ${data.text}');
      print('');
    },
    onError: (error) => print('Error: $error'),
  );

  await client.connect();

  client.send('Hello, world!');

  // ignore: constant_identifier_names
  const MCCP2 = 86;
  client.doo(MCCP2);

  // await client.disconnect();
}
3
likes
0
pub points
71%
popularity

Publisher

verified publishercasraf.dev

A simple Telnet client for Dart/Flutter, parse incoming and outgoing data easily and quickly.

Repository (GitHub)
View/report issues

License

unknown (license)

More

Packages that depend on ctelnet