Crate udt [] [src]

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);

Modules

UdtOpts

Various options that can be passed to getsockopt or setsockopt

Structs

Epoll

Used with the epoll* methods of a UDTSocket

EpollEvents

This is a bitflag field that can be constructed with UDT_EPOLL_IN, UDT_EPOLL_OUT, or UDT_EPOLL_ERR

Linger

Linger option

UdtError

A UDT Error

UdtSocket

A UDT Socket

Enums

SocketFamily
SocketType

Socket type

UdtStatus

Constants

UDT_EPOLL_ERR

An Epoll Event to watch for exception events

UDT_EPOLL_IN

An Epoll Event to watch for read events

UDT_EPOLL_OUT

An Epoll Event to watch for write events

Traits

UdtOption

Functions

init

Initialize the UDT library.