pub struct NetcodeSocket(/* private fields */);
Expand description
A wrapper around UdpSocket
that implements the Transceiver
trait for use in the netcode protocol.
NetcodeSocket
is responsible for creating and managing a UDP socket, handling non-blocking
send and receive operations, and providing the local address of the socket.
§Note
This is a lower-level component and should not be used directly unless you have a specific use case.
For most applications, it is recommended to use higher-level abstractions such as Client::new
or
Client::with_config
to create and manage clients.
§Example
use netcode::NetcodeSocket;
use std::net::SocketAddr;
let addr = "127.0.0.1:41235";
let send_buf_size = 256 * 1024;
let recv_buf_size = 256 * 1024;
let socket = NetcodeSocket::new(addr, send_buf_size, recv_buf_size).unwrap();
Implementations§
Source§impl NetcodeSocket
impl NetcodeSocket
Trait Implementations§
Source§impl Transceiver for NetcodeSocket
impl Transceiver for NetcodeSocket
Auto Trait Implementations§
impl Freeze for NetcodeSocket
impl RefUnwindSafe for NetcodeSocket
impl Send for NetcodeSocket
impl Sync for NetcodeSocket
impl Unpin for NetcodeSocket
impl UnwindSafe for NetcodeSocket
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