pub struct RaknetListener { /* private fields */ }
Expand description
Implementation of Raknet Server.
Implementations§
Source§impl RaknetListener
impl RaknetListener
Sourcepub async fn bind(sockaddr: &SocketAddr) -> Result<Self, RaknetError>
pub async fn bind(sockaddr: &SocketAddr) -> Result<Self, RaknetError>
Sourcepub async fn accept(&mut self) -> Result<RaknetSocket, RaknetError>
pub async fn accept(&mut self) -> Result<RaknetSocket, RaknetError>
Waiting for and receiving new Raknet connections, returning a Raknet socket
Call this method must be after calling RaknetListener::listen()
§Example
ⓘ
let mut listener = RaknetListener::bind("127.0.0.1:19132".parse().unwrap()).await.unwrap();
listener.listen().await;
let mut socket = listener.accept().await.unwrap();
Sourcepub async fn set_motd(
&mut self,
server_name: &str,
max_connection: u32,
mc_protocol_version: &str,
mc_version: &str,
game_type: &str,
port: u16,
)
pub async fn set_motd( &mut self, server_name: &str, max_connection: u32, mc_protocol_version: &str, mc_version: &str, game_type: &str, port: u16, )
Set the current motd, this motd will be provided to the client in the unconnected pong.
Call this method must be after calling RaknetListener::listen()
§Example
ⓘ
let mut listener = RaknetListener::bind("127.0.0.1:19132".parse().unwrap()).await.unwrap();
listener.set_motd("Another Minecraft Server" , 999999 , "486" , "1.18.11", "Survival" , 19132).await;
Sourcepub fn local_addr(&self) -> Result<SocketAddr, RaknetError>
pub fn local_addr(&self) -> Result<SocketAddr, RaknetError>
Sourcepub fn set_full_motd(&mut self, motd: String) -> Result<(), RaknetError>
pub fn set_full_motd(&mut self, motd: String) -> Result<(), RaknetError>
pub async fn get_peer_raknet_version( &self, peer: &SocketAddr, ) -> Result<u8, RaknetError>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RaknetListener
impl !RefUnwindSafe for RaknetListener
impl Send for RaknetListener
impl Sync for RaknetListener
impl Unpin for RaknetListener
impl !UnwindSafe for RaknetListener
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