Struct rustarium::socket::Socket
[−]
[src]
pub struct Socket { /* fields omitted */ }
Wrapper around UdpSocket.
Methods
impl Socket
[src]
fn new(port: u16) -> Self
[src]
Create a new Socket.
This function binds to the computer's local IP address. To
bind to a custom address, use Socket::new_any_ip()
fn new_any_ip<A: ToSocketAddrs>(addr: A) -> Self
[src]
Create a new Socket bound to any IP address.
fn get(&self) -> Option<(SocketAddr, String)>
[src]
Get a message, if one is waiting.
Returns the sender's SocketAddr
, and a String
containing
the message text itself.
Returns None
if there are no waiting messages.
fn send(&mut self, address: &SocketAddr, message: String)
[src]
Send a message.