Skip to content

Instantly share code, notes, and snippets.

@hrektts
hrektts / udp_echo_server_tokio.rs
Last active November 1, 2016 09:47
UDP echo server with futures and tokio.
extern crate futures;
#[macro_use]
extern crate tokio_core;
use std::env;
use std::io::{Error, ErrorKind};
use std::net::SocketAddr;
use futures::{Async, Future, Poll};
use tokio_core::net::UdpSocket;
@hrektts
hrektts / udp_echo_server.rs
Created July 1, 2016 05:51
UDP echo server with rotor.
extern crate rotor;
use std::io::{Write, stderr};
use std::ops::DerefMut;
use rotor::{EventSet, PollOpt, Loop, Config, Void};
use rotor::mio::udp::{UdpSocket};
use rotor::{Machine, Response, EarlyScope, Scope};
struct Context {
buf: [u8; 1024],