Skip to content

RakNetServer

Olybear9 edited this page Jul 18, 2021 · 1 revision

The RakNetServer struct is defined as follows:

pub struct RakNetServer {
     pub address: String,
     pub version: RakNetVersion,
     pub connections: Arc<Mutex<HashMap<String, Connection>>>,
     pub start_time: SystemTime
}

RakNetServer Methods

static new(address: String) -> RakNetServer

Parameter Type Description
address String A string containing a valid origin address. EG: 192.168.0.1:19132

Creates a instance which can later be started.

Example:

let mut server = RakNetServer::new(String::from("0.0.0.0:19132"));

Return Type Description
Tuple<JoinHandle,JoinHandle> A tuple of the Threads started by RakNet

Starts the two Client and Server threads for accepting connections with RakNet.

Example:

let (send, recv) = server.start();
send.join().unwrap();
recv.join().unwrap();

⚠️ Note:

These handles are returned to allow ease when making RakNet concurrently.

API

Implementation

Clone this wiki locally