5 releases
Uses old Rust 2015
0.2.0 | Aug 17, 2016 |
---|---|
0.1.4 | Oct 11, 2015 |
0.1.2 | Oct 7, 2015 |
0.1.1 | Oct 5, 2015 |
0.1.0 | Oct 4, 2015 |
#3 in #udt
84 downloads per month
Used in shoop
45KB
575 lines
udt-rs
UDT bindings for rust
What is UDT?
See http://udt.sourceforge.net/
Documentation and examples
In progress, see the documentation
License
The bindings are distributed under a BSD license.
UDT is distributed under a BSD license (copyright held by The Board of Trustees of the University of Illinois). See here
The wrapper is distributed user a BSD license (copyright held by Brave New Software). See here
lib.rs
:
Note about these docs
These docs are mostly copied verbatim from the UDT documentation. If you see references to the C++ function names instead of the rust function names, that's why.
UDT
Bindings to the UDT4 high performance data data transfer library
UDT follows closely the BSD socket API, but several of the functions have different semantics.
UDT is a high performance data transfer protocol - UDP-based data transfer protocol. It was designed for data intensive applications over high speed wide area networks, to overcome the efficiency and fairness problems of TCP. As its name indicates, UDT is built on top of UDP and it provides both reliable data streaming and messaging services.
Examples
To create a Datagram server, that can send and receive messages:
use std::str::FromStr;
use std::net::{SocketAddr, SocketAddrV4};
use udt::*;
let localhost = std::net::Ipv4Addr::from_str("127.0.0.1").unwrap();
let sock = UdtSocket::new(SocketFamily::AFInet, SocketType::Stream).unwrap();
sock.bind(SocketAddr::V4(SocketAddrV4::new(localhost, 0))).unwrap();
let my_addr = sock.getsockname().unwrap();
println!("Server bound to {:?}", my_addr);
sock.listen(5).unwrap();
let (mut new_socket, peer) = sock.accept().unwrap();
println!("Received new connection from peer {:?}", peer);
Various options that can be passed to getsockopt
or setsockopt
These are typed in such a way so that when they are used with getsockopt
or setsockopt
,
they will require the right data type.
Examples
use udt::*;
let sock = UdtSocket::new(SocketFamily::AFInet, SocketType::Stream).unwrap();
let recv_buf: i32 = sock.getsockopt(UdtOpts::UDT_RCVBUF).unwrap();
let rendezvous: bool = sock.getsockopt(UdtOpts::UDT_RENDEZVOUS).unwrap();
Dependencies
~335KB