rust-sctp icon indicating copy to clipboard operation
rust-sctp copied to clipboard

Can't properly send data through Write.

Open nyovaya opened this issue 6 years ago • 2 comments

On the client I sent data through SctpStream's Write impl. On the server side I tried to read it using:

let sock = sctp::SctpEndpoint::bind("127.0.0.1:2000").unwrap(); loop{ let mut v = Vec::new(); sock.recv_from(&mut v[..]).unwrap(); println!("msg: {}", std::str::from_utf8(&v[..]).unwrap()); }

This returns the error:

thread 'main' panicked at 'called Result::unwrap() on an Err value: Os { code: 0, kind: Other, message: "Success" }', libcore/result.rs:1009:5

nyovaya avatar Jan 17 '19 19:01 nyovaya

Ok it was because the slice's size is 0 - I don't like the Error message, it should return a proper error message when the len is 0.

nyovaya avatar Jan 18 '19 14:01 nyovaya

I would create a PR - @phsym still working on this one? - I have others additions too.

nyovaya avatar Jan 22 '19 18:01 nyovaya