Function ggrs::start_p2p_spectator_session [−][src]
pub fn start_p2p_spectator_session(
num_players: u32,
input_size: usize,
local_port: u16,
host_addr: SocketAddr
) -> Result<P2PSpectatorSession, GGRSError>
Expand description
Used to create a new P2PSpectatorSession
for a spectator.
The session will receive inputs from all players from the given host directly.
Example
let local_port: u16 = 7777;
let num_players : u32 = 2;
let input_size : usize = std::mem::size_of::<u32>();
let host_addr: SocketAddr = "127.0.0.1:8888".parse()?;
let mut sess = ggrs::start_p2p_spectator_session(num_players, input_size, local_port, host_addr)?;
Errors
- Will return a
InvalidRequest
if the number of players is higher than the allowed maximum (seeMAX_PLAYERS
). - Will return a
InvalidRequest
ifinput_size
is higher than the allowed maximum (seeMAX_INPUT_BYTES
). - Will return
SocketCreationFailed
if the UPD socket could not be created.