1//! Network-related operations. 2//! 3//! On Windows, one must call [`wsa_startup`] in the process before calling any 4//! of these APIs. [`wsa_cleanup`] may be used in the process if these APIs are 5//! no longer needed. 6//! 7//! [`wsa_startup`]: https://docs.rs/rustix/latest/x86_64-pc-windows-msvc/rustix/net/fn.wsa_startup.html 8//! [`wsa_cleanup`]: https://docs.rs/rustix/latest/x86_64-pc-windows-msvc/rustix/net/fn.wsa_cleanup.html 9 10#[cfg(not(feature = "std"))] 11mod addr; 12#[cfg(not(feature = "std"))] 13mod ip; 14mod send_recv; 15mod socket; 16mod socket_addr_any; 17#[cfg(not(any(windows, target_os = "wasi")))] 18mod socketpair; 19#[cfg(windows)] 20mod wsa; 21 22pub mod sockopt; 23 24pub use send_recv::{ 25 recv, recvfrom, send, sendto, sendto_any, sendto_v4, sendto_v6, RecvFlags, SendFlags, 26}; 27pub use socket::{ 28 accept, accept_with, acceptfrom, acceptfrom_with, bind, bind_any, bind_v4, bind_v6, connect, 29 connect_any, connect_v4, connect_v6, getpeername, getsockname, listen, shutdown, socket, 30 socket_with, AcceptFlags, AddressFamily, Protocol, Shutdown, SocketFlags, SocketType, 31}; 32pub use socket_addr_any::{SocketAddrAny, SocketAddrStorage}; 33#[cfg(not(any(windows, target_os = "wasi")))] 34pub use socketpair::socketpair; 35#[cfg(feature = "std")] 36pub use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6}; 37#[cfg(windows)] 38pub use wsa::{wsa_cleanup, wsa_startup}; 39#[cfg(not(feature = "std"))] 40pub use { 41 addr::{SocketAddr, SocketAddrV4, SocketAddrV6}, 42 ip::{IpAddr, Ipv4Addr, Ipv6Addr, Ipv6MulticastScope}, 43}; 44#[cfg(unix)] 45pub use { 46 send_recv::sendto_unix, 47 socket::{bind_unix, connect_unix, SocketAddrUnix}, 48}; 49