Skip to main content

Session

Struct Session 

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

One independent, reliable EQ UDP session. Sequence numbers and CRC state belong to this socket and are discarded on world/zone transitions.

Implementations§

Source§

impl Session

Source

pub fn local_address(&self) -> Result<SocketAddr, Error>

Return the local UDP address selected for this session.

§Errors

Returns an error when the operating system cannot read the socket address.

Source

pub fn last_received_seconds(&self) -> u64

Return whole seconds since the last valid server datagram.

Source

pub fn connect( address: SocketAddr, echo_response: bool, ) -> Result<Session, Error>

Negotiate a new reliable EQ UDP session with the remote endpoint.

§Errors

Returns an error when socket setup, negotiation, or validation fails.

Source

pub fn connect_cancellable( address: SocketAddr, echo_response: bool, stop: &Atomic<bool>, ) -> Result<Session, Error>

Negotiate a session while allowing its owner to cancel network waits.

§Errors

Returns an error on cancellation, timeout, socket failure, or an unsupported negotiation response.

Source

pub fn send(&mut self, opcode: u16, body: &[u8]) -> Result<(), Error>

Send one reliable application packet, fragmenting it when necessary.

§Errors

Returns an error when the session is closed, a size limit is exceeded, or the UDP socket cannot send a packet.

Source

pub fn send_unreliable(&self, opcode: u16, body: &[u8]) -> Result<(), Error>

Send an unsequenced application packet, used for position heartbeats.

§Errors

Returns an error for an unsupported opcode, an oversized datagram, or a UDP socket failure.

Source

pub fn receive(&mut self) -> Result<Option<Application>, Error>

Drive retransmits and acknowledgements, returning the next full packet.

§Errors

Returns an error for malformed packets, protocol-limit violations, timeouts, or UDP socket failures.

Source

pub fn close(&mut self) -> Result<(), Error>

Send the session disconnect control packet once.

§Errors

Returns an error when the UDP socket cannot send the disconnect packet.

Trait Implementations§

Source§

impl Drop for Session

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V