pub struct ClientHandle<T: IdentityType + Clone + Eq + Hash + Send + ToString + 'static, AE: AsyncExecutor + 'static> { /* private fields */ }Expand description
Handle to a connected client, providing send/receive operations. Not cloneable — only one handle per connection.
Implementations§
Source§impl<T: IdentityType + Clone + Eq + Hash + Send + ToString, AE: AsyncExecutor> ClientHandle<T, AE>
impl<T: IdentityType + Clone + Eq + Hash + Send + ToString, AE: AsyncExecutor> ClientHandle<T, AE>
Sourcepub async fn send(
&self,
packet: DynamicByteBuffer,
) -> Result<(), ServerSocketError>
pub async fn send( &self, packet: DynamicByteBuffer, ) -> Result<(), ServerSocketError>
Send a packet using a pre-allocated buffer.
Sourcepub async fn send_bytes(&self, data: &[u8]) -> Result<(), ServerSocketError>
pub async fn send_bytes(&self, data: &[u8]) -> Result<(), ServerSocketError>
Send a byte slice, splitting into payload-sized chunks so each wire packet fits within MTU.
See ClientSocket::send_bytes — same fragmentation-only-when-needed +
TYPHOON_SEND_BYTES_JITTER-driven per-chunk length sampling applies
here for s2c traffic.
Sourcepub fn max_data_payload(&self) -> usize
pub fn max_data_payload(&self) -> usize
Maximum user-data bytes per send call so the wire packet fits within MTU.
Sourcepub async fn receive(&self) -> Result<DynamicByteBuffer, ServerSocketError>
pub async fn receive(&self) -> Result<DynamicByteBuffer, ServerSocketError>
Receive a packet, returning the decrypted payload as a buffer.
Sourcepub async fn receive_bytes(&self) -> Result<Vec<u8>, ServerSocketError>
pub async fn receive_bytes(&self) -> Result<Vec<u8>, ServerSocketError>
Receive a packet, returning the decrypted payload as a byte vector.
Trait Implementations§
Source§impl<T: IdentityType + Clone + Eq + Hash + Send + ToString + 'static, AE: AsyncExecutor + 'static> Drop for ClientHandle<T, AE>
impl<T: IdentityType + Clone + Eq + Hash + Send + ToString + 'static, AE: AsyncExecutor + 'static> Drop for ClientHandle<T, AE>
Auto Trait Implementations§
impl<T, AE> !Freeze for ClientHandle<T, AE>
impl<T, AE> !RefUnwindSafe for ClientHandle<T, AE>
impl<T, AE> !UnwindSafe for ClientHandle<T, AE>
impl<T, AE> Send for ClientHandle<T, AE>
impl<T, AE> Sync for ClientHandle<T, AE>
impl<T, AE> Unpin for ClientHandle<T, AE>where
T: Unpin,
impl<T, AE> UnsafeUnpin for ClientHandle<T, AE>where
T: UnsafeUnpin,
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