soio
Soio is a I/O library for Rust.
Document
Usage
First, add this to your Cargo.toml
:
[]
= "0.1"
Then, add this to your crate root:
extern crate soio:
Example:
use ;
use ;
// Setup some tokens to allow us to identify which event is
// for which socket.
const SERVER: Token = Token;
const CLIENT: Token = Token;
let addr = "127.0.0.1:13265".parse.unwrap;
// Setup the server socket
let server = bind.unwrap;
// Create an poll instance
let poll = new.unwrap;
// Start listening for incoming connections
poll.register.unwrap;
// Setup the client socket
let sock = connect.unwrap;
// Register the socket
poll.register.unwrap;
// Create storage for events
let mut events = with_capacity;
loop
Feature
- Bakced by epoll, kqueue
- Non-blocking TCP, UDP sockets
- Thread safe message channel for cross thread communication
Platforms
- Linux
- OS X
- NetBSD
- Android
- iOS