pub struct TcpClient { /* private fields */ }
Implementations§
Source§impl TcpClient
impl TcpClient
Sourcepub fn new(server_ip: String, server_port: u16) -> Result<Self>
pub fn new(server_ip: String, server_port: u16) -> Result<Self>
Create a new TCP connection to the specified server and connect to it
Sourcepub fn server_info(&self) -> (String, u16)
pub fn server_info(&self) -> (String, u16)
Get the server IP and port information
pub fn send(&mut self, data: &[u8]) -> Result<()>
pub fn receive(&mut self) -> Result<Vec<u8>>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TcpClient
impl RefUnwindSafe for TcpClient
impl Send for TcpClient
impl Sync for TcpClient
impl Unpin for TcpClient
impl UnwindSafe for TcpClient
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