[−][src]Struct async_resol_vbus::TcpClientHandshake
Handles the client-side of the VBus-over-TCP handshake.
Examples
use async_std::net::{SocketAddr, TcpStream}; use async_resol_vbus::TcpClientHandshake; let address = "192.168.5.217:7053".parse::<SocketAddr>()?; let stream = TcpStream::connect(address).await?; let mut hs = TcpClientHandshake::start(stream).await?; hs.send_pass_command("vbus").await?; let stream = hs.send_data_command().await?; // ...
Methods
impl TcpClientHandshake
[src]
pub async fn start(stream: TcpStream) -> Result<TcpClientHandshake>
[src]
Start the handshake by waiting for the initial greeting reply from the service.
pub fn into_inner(self) -> TcpStream
[src]
Consume self
and return the underlying TcpStream
.
pub async fn send_connect_command<'_, '_>(
&'_ mut self,
via_tag: &'_ str
) -> Result<()>
[src]
&'_ mut self,
via_tag: &'_ str
) -> Result<()>
Send the CONNECT
command and wait for the reply.
pub async fn send_pass_command<'_, '_>(
&'_ mut self,
password: &'_ str
) -> Result<()>
[src]
&'_ mut self,
password: &'_ str
) -> Result<()>
Send the PASS
command and wait for the reply.
pub async fn send_channel_command<'_>(&'_ mut self, channel: u8) -> Result<()>
[src]
Send the CHANNEL
command and wait for the reply.
pub async fn send_data_command(__arg0: Self) -> Result<TcpStream>
[src]
Send the DATA
command and wait for the reply.
This function returns the underlying TcpStream
since the handshake is complete
after sending this command.
pub async fn send_quit_command(__arg0: Self) -> Result<()>
[src]
Send the QUIT
command and wait for the reply.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for TcpClientHandshake
impl Send for TcpClientHandshake
impl Sync for TcpClientHandshake
impl Unpin for TcpClientHandshake
impl UnwindSafe for TcpClientHandshake
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,