1 #![cfg(not(loom))] 2 3 //! TCP/UDP/Unix bindings for `tokio`. 4 //! 5 //! This module contains the TCP/UDP/Unix networking types, similar to the standard 6 //! library, which can be used to implement networking protocols. 7 //! 8 //! # Organization 9 //! 10 //! * [`TcpListener`] and [`TcpStream`] provide functionality for communication over TCP 11 //! * [`UdpSocket`] provides functionality for communication over UDP 12 //! * [`UnixListener`] and [`UnixStream`] provide functionality for communication over a 13 //! Unix Domain Stream Socket **(available on Unix only)** 14 //! * [`UnixDatagram`] provides functionality for communication 15 //! over Unix Domain Datagram Socket **(available on Unix only)** 16 //! * [`tokio::net::unix::pipe`] for FIFO pipes **(available on Unix only)** 17 //! * [`tokio::net::windows::named_pipe`] for Named Pipes **(available on Windows only)** 18 //! 19 //! For IO resources not available in `tokio::net`, you can use [`AsyncFd`]. 20 //! 21 //! [`TcpListener`]: TcpListener 22 //! [`TcpStream`]: TcpStream 23 //! [`UdpSocket`]: UdpSocket 24 //! [`UnixListener`]: UnixListener 25 //! [`UnixStream`]: UnixStream 26 //! [`UnixDatagram`]: UnixDatagram 27 //! [`tokio::net::unix::pipe`]: unix::pipe 28 //! [`tokio::net::windows::named_pipe`]: windows::named_pipe 29 //! [`AsyncFd`]: crate::io::unix::AsyncFd 30 31 mod addr; 32 cfg_not_wasi! { 33 #[cfg(feature = "net")] 34 pub(crate) use addr::to_socket_addrs; 35 } 36 pub use addr::ToSocketAddrs; 37 38 cfg_net! { 39 mod lookup_host; 40 pub use lookup_host::lookup_host; 41 42 pub mod tcp; 43 pub use tcp::listener::TcpListener; 44 pub use tcp::stream::TcpStream; 45 cfg_not_wasi! { 46 pub use tcp::socket::TcpSocket; 47 48 mod udp; 49 #[doc(inline)] 50 pub use udp::UdpSocket; 51 } 52 } 53 54 cfg_net_unix! { 55 pub mod unix; 56 pub use unix::datagram::socket::UnixDatagram; 57 pub use unix::listener::UnixListener; 58 pub use unix::stream::UnixStream; 59 pub use unix::socket::UnixSocket; 60 } 61 62 cfg_net_windows! { 63 pub mod windows; 64 } 65