[][src]Struct kcpclient::kcp_client::client::KcpClient

pub struct KcpClient { /* fields omitted */ }

KCP 客户端

Implementations

impl KcpClient[src]

pub fn connect<A: ToSocketAddrs>(
    addr: A,
    config: KcpConfig
) -> Result<KcpClient, Box<dyn Error>>
[src]

连接

pub fn init_conv(&self) -> Result<u32, Box<dyn Error>>[src]

从远程服务器获取并设置conv 发送4字节令牌,收到8字节 4字节令牌+4字节CONV

pub fn set_conv(&self, conv: u32) -> Result<(), Box<dyn Error>>[src]

手动设置conv

pub fn check_conv(&self) -> bool[src]

检查conv是否设置如果0 就是没有设置返回false

pub fn recv(&self) -> Result<Bytes, Box<dyn Error>>[src]

读取数据包

pub fn update(&self) -> Result<(), Box<dyn Error>>[src]

更新

pub fn send(&self, data: &[u8]) -> Result<usize, Box<dyn Error>>[src]

发送

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.