telnet-rs
telnet-rs copied to clipboard
Reading cause split data randomly
Hi, I am using 0.1.4 version of telnet-rs .
Error
The telnet rs only read first part of data
How to fix
https://github.com/SLMT/telnet-rs/blob/80eddf03029dcfd60c107409b011debc7695db3b/src/lib.rs#L168
If we can change read method to read_to_end , we will able to read all of tcp parts.
Client code
let mut stream = Telnet::connect(("whois.nic.uno", 43), 1024 * 1024).expect("Couldn't connect to the server...");
stream.write("kaan.uno \n".as_bytes()).expect("Write Error");
// sleep(Duration::from_secs(1));
let event = stream.read().expect("Read Error");
if let TelnetEvent::Data(buf) = event.borrow() {
println!("{}", from_utf8(&buf).unwrap()); // Sometimes full data some time half of data
}
Half data

Full data

Tcp data

Thanks for your report. We will look into it.