pub struct NetcodeClientTransport { /* private fields */ }Implementations§
Source§impl NetcodeClientTransport
impl NetcodeClientTransport
pub fn new( current_time: Duration, authentication: ClientAuthentication, socket: UdpSocket, ) -> Result<Self, NetcodeError>
pub fn addr(&self) -> Result<SocketAddr>
pub fn client_id(&self) -> ClientId
Sourcepub fn time_since_last_received_packet(&self) -> Duration
pub fn time_since_last_received_packet(&self) -> Duration
Returns the duration since the client last received a packet. Usefull to detect timeouts.
Sourcepub fn disconnect(&mut self)
pub fn disconnect(&mut self)
Disconnect the client from the transport layer. This sends the disconnect packet instantly, use this when closing/exiting games, should use [RenetClient::disconnect][crate::RenetClient::disconnect] otherwise.
Sourcepub fn disconnect_reason(&self) -> Option<DisconnectReason>
pub fn disconnect_reason(&self) -> Option<DisconnectReason>
If the client is disconnected, returns the reason.
Sourcepub fn send_packets(
&mut self,
connection: &mut RenetClient,
) -> Result<(), NetcodeTransportError>
pub fn send_packets( &mut self, connection: &mut RenetClient, ) -> Result<(), NetcodeTransportError>
Send packets to the server. Should be called every tick
Sourcepub fn update(
&mut self,
duration: Duration,
client: &mut RenetClient,
) -> Result<(), NetcodeTransportError>
pub fn update( &mut self, duration: Duration, client: &mut RenetClient, ) -> Result<(), NetcodeTransportError>
Advances the transport by the duration, and receive packets from the network.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for NetcodeClientTransport
impl RefUnwindSafe for NetcodeClientTransport
impl Send for NetcodeClientTransport
impl Sync for NetcodeClientTransport
impl Unpin for NetcodeClientTransport
impl UnwindSafe for NetcodeClientTransport
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more