Struct string_telephone::server::Server
[-]
[+]
[src]
pub struct Server<T> { pub addr: SocketAddr, pub config: ConnectionConfig<T>, // some fields omitted }
A UDP server, which manages multiple clients
Fields
addr | Which address to listen on |
config | Basic configuration for the server |
Methods
impl<T> Server<T>
fn new(addr: SocketAddr, config: ConnectionConfig<T>) -> IoResult<Server<T>>
Start listening on a given socket
fn poll(&mut self) -> Option<(PacketOrCommand<T>, SocketAddr)>
Pump any messages that have been sent to us
Note that this internally accepts connections and disconnects, with the original packets being returned
fn cull(&mut self) -> Vec<SocketAddr>
Disconnect, and return, any sockets that have not contacted us for our timeout duration
fn send_to(&mut self, packet: &T, addr: &SocketAddr) -> bool
Send a packet to a specific address
This will return false if the given address isn't connected to us
fn send_to_many(&mut self, packet: &T, addrs: &Vec<SocketAddr>)
Send a packet to multiple addresses
fn send_to_all(&mut self, packet: &T)
Send a packet to every connected client
fn all_connections(&self) -> Vec<SocketAddr>
List all of our current connections