| Crates.io | telnet |
| lib.rs | telnet |
| version | 0.2.4 |
| created_at | 2017-12-22 13:06:23.958194+00 |
| updated_at | 2025-05-01 08:11:30.752009+00 |
| description | A simple implementation of telnet protocol. |
| homepage | https://github.com/SLMT/telnet-rs |
| repository | https://github.com/SLMT/telnet-rs |
| max_upload_size | |
| id | 44032 |
| size | 52,421 |
A simple Telnet implementation.
use telnet::{Telnet, Event};
fn main() {
let mut telnet = Telnet::connect(("ptt.cc", 23), 256)
.expect("Couldn't connect to the server...");
loop {
let event = telnet.read().expect("Read error");
if let Event::Data(buffer) = event {
// Debug: print the data buffer
println!("{:?}", buffer);
// process the data buffer
}
}
}
use telnet::{Telnet, Event};
fn main() {
let mut telnet = Telnet::connect(("ptt.cc", 23), 256)
.expect("Couldn't connect to the server...");
loop {
let event = telnet.read_nonblocking().expect("Read error");
if let Event::Data(buffer) = event {
// Debug: print the data buffer
println!("{:?}", buffer);
// process the data buffer
}
// Do something else ...
}
}
use telnet::Telnet;
fn main() {
let mut telnet = Telnet::connect(("ptt.cc", 23), 256)
.expect("Couldn't connect to the server...");
let buffer: [u8; 4] = [83, 76, 77, 84];
telnet.write(&buffer).expect("Read error");
}