pub fn udp_server(chan: SyncSender<Event>, port: u16) {
    let mut core = Core::new().unwrap();
    let handle = core.handle();

    let addr = SocketAddrV4::new(Ipv4Addr::new(0, 0, 0, 0), port);
    let addr = addr.to_socket_addrs().unwrap().last().unwrap();

    let socket = UdpSocket::bind(&addr, &handle).unwrap();
    let (_, stream) =
        socket.framed(LineCodec).split();

    let stream = stream.for_each(|(_addr, msg)| {
        let res = chan.send(Event::UdpMessage(Vec::from(msg)));
        res.expect("Cannot send udp message to channel");
        future::ok(())
    });
    let res = core.run(stream);
    res.expect("Udp metrics socket failed");
}
/// Setup the UDP socket that listens for metrics and
/// publishes them into the bucket storage.
Setup the UDP socket that listens for metrics and
publishes them into the bucket storage.
Setup the UDP socket that listens for metrics and publishes them into the bucket storage .
pub fn udp_server(chan: SyncSender<Event>, port: u16) {
    let mut core = Core::new().unwrap();
    let handle = core.handle();
    let addr = SocketAddrV4::new(Ipv4Addr::new(0, 0, 0, 0), port);
    let addr = addr.to_socket_addrs().unwrap().last().unwrap();
    let socket = UdpSocket::bind(&addr, &handle).unwrap();
    let (_, stream) =
        socket.framed(LineCodec).split();
    let stream = stream.for_each(|(_addr, msg)| {
        let res = chan.send(Event::UdpMessage(Vec::from(msg)));
        res.expect("Cannot send udp message to channel");
        future::ok(())
    });
    let res = core.run(stream);
    res.expect("Udp metrics socket failed");
}
pub fn udp_server ( chan : SyncSender < Event > , port : u16 ) { let mut core = Core :: new ( ) . unwrap ( ) ; let handle = core . handle ( ) ; let addr = SocketAddrV4 :: new ( Ipv4Addr :: new ( 0 , 0 , 0 , 0 ) , port ) ; let addr = addr . to_socket_addrs ( ) . unwrap ( ) . last ( ) . unwrap ( ) ; let socket = UdpSocket :: bind ( & addr , & handle ) . unwrap ( ) ; let ( _ , stream ) = socket . framed ( LineCodec ) . split ( ) ; let stream = stream . for_each ( | ( _addr , msg ) | { let res = chan . send ( Event :: UdpMessage ( Vec :: from ( msg ) ) ) ; res . expect ( " " ) ; future :: ok ( ( ) ) } ) ; let res = core . run ( stream ) ; res . expect ( " " ) ; }
Setup the UDP socket that listens for metrics and
publishes them into the bucket storage.
Setup the UDP socket that listens for metrics and publishes them into the bucket storage .
chan
SyncSender<Event>
port
u16