[−][src]Type Definition stubborn_io::StubbornTcpStream
type StubbornTcpStream = StubbornIo<TcpStream, SocketAddr>;
A drop in replacement for tokio's TcpStream, with the distinction that it will automatically attempt to reconnect in the face of connectivity failures.
#![feature(async_await)] use std::net::{IpAddr, Ipv4Addr, SocketAddr}; use stubborn_io::StubbornTcpStream; let addr = SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 8080); async { let tcp_stream = StubbornTcpStream::connect(&addr).await.unwrap(); let regular_tokio_tcp_function_result = tcp_stream.peer_addr(); };