Skip to main content

Networking

Struct Networking 

Source
pub struct Networking { /* private fields */ }
Expand description

Access to the steam networking interface

Implementations§

Source§

impl Networking

Source

pub fn accept_p2p_session(&self, user: SteamId) -> bool

Accepts incoming packets from the given user

Should only be called in response to a P2PSessionRequest.

Source

pub fn close_p2p_session(&self, user: SteamId) -> bool

Closes the p2p connection between the given user

Source

pub fn get_p2p_session_state(&self, user: SteamId) -> Option<P2PSessionState>

Gets the connection state to the specified user

Returns the P2P session state if a connection exists with the user, or None if no connection exists.

Source

pub fn send_p2p_packet( &self, remote: SteamId, send_type: SendType, data: &[u8], ) -> bool

Sends a packet to the user, starting the connection if it isn’t started already

Source

pub fn send_p2p_packet_on_channel( &self, remote: SteamId, send_type: SendType, data: &[u8], channel: i32, ) -> bool

Sends a packet to the user on a specific channel

Source

pub fn is_p2p_packet_available(&self) -> Option<usize>

Returns whether there is a packet queued that can be read.

Returns the size of the queued packet if any.

Source

pub fn is_p2p_packet_available_on_channel(&self, channel: i32) -> Option<usize>

Returns whether there is a packet available on a specific channel

Source

pub fn read_p2p_packet(&self, buf: &mut [u8]) -> Option<(SteamId, usize)>

Attempts to read a queued packet into the buffer if there are any.

Returns the steam id of the sender and the size of the packet.

Source

pub fn read_p2p_packet_from_channel( &self, buf: &mut [u8], channel: i32, ) -> Option<(SteamId, usize)>

Attempts to read a queued packet into the buffer from a specific channel

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.