Skip to content

Instantly share code, notes, and snippets.

@benaryorg
Last active September 3, 2015 22:05
Show Gist options
  • Save benaryorg/0eed26b88b71eea4bed0 to your computer and use it in GitHub Desktop.
Save benaryorg/0eed26b88b71eea4bed0 to your computer and use it in GitHub Desktop.
extern crate sctp;
use sctp::SctpEndpoint;
fn main()
{
let mut buf : Vec<u8> = Vec::new();
let endpoint = SctpEndpoint::bind("localhost:1337").unwrap();
println!("Meow.");
loop
{
if let Ok((_len,_stream,_addr)) = endpoint.recv_from(&mut buf)
{
if let Ok(msg) = String::from_utf8(buf.clone())
{
println!("Message: \"{}\"",msg);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment