Struct unreliable_message::network::Sender [] [src]

pub struct Sender {
    pub datagram_length: u16,
    pub replication: u8,
    // some fields omitted
}

The sending end of an unreliable message socket.

Fields

Methods

impl Sender
[src]

Constructs a sender from a socket.

  • datagram_length is the max-size of a UDP packet.
  • replication is the amout of times that a chunk will get re-sent.

replication should almost always be 1, and rarely 2 or above.

Adds a message to the queue of chunks to send out.

Attempts to send one UDP packet over the network.

The size of the UDP packet is bounded by self.datagram_length.

Returns

  • Err(e) if an error occurred during sending.
  • Ok(true) if there are more messages in the queue.
  • Ok(false) if theere are no more messages in the queue.

Attemts to send all UDP packets by repeatedly calling send_one.