Rust Data Transfer Protocol
Cross-platform networking interfaces for Rust.
The two fundamental network objects this library provides are the server and client. When starting a server or connecting via a client, the thread will not block while it performs network operations in the background. Upon instantiation, both the server and client return handles that provide a mechanism for communicating with the background thread, and instructing it to provide status information or halt network operations. If any network object goes out of scope before background operations are terminated, the operations will be cancelled automatically, and all network interfaces will be closed.
Creating a server
A server can be built using the Server
implementation:
use Server;
let server = new
.on_receive
.on_connect
.on_disconnect
.start
.unwrap;
println!;
assert!;
server.stop.unwrap;
assert!;
Creating a client
A client can be built using the Client
implementation:
use Client;
let client = new
.on_receive
.on_disconnected
.connect
.unwrap;
println!;
assert!;
client.disconnect.unwrap;
assert!;