std.net
tcp/udp facade over net.os/addr/socket/tcp/udp; re-exports their types call net::init() once per process before any socket call
NetError
Section titled “NetError”pub NetError :: os::NetErrorSocketAddr
Section titled “SocketAddr”pub SocketAddr :: addr::SocketAddrTcpStream
Section titled “TcpStream”pub TcpStream :: tcp::TcpStreamTcpListener
Section titled “TcpListener”pub TcpListener :: tcp::TcpListenerAccepted
Section titled “Accepted”pub Accepted :: tcp::AcceptedUdpSocket
Section titled “UdpSocket”pub UdpSocket :: udp::UdpSocketDatagram
Section titled “Datagram”pub Datagram :: udp::Datagrampub init :: fn() -> void ! NetErrorinit winsock; once, before any socket call
shutdown
Section titled “shutdown”pub shutdown :: fn()tear down winsock; optional, at exit
last_error
Section titled “last_error”pub last_error :: fn() -> i32last winsock error on this thread (WSAGetLastError)
connect
Section titled “connect”pub connect :: fn(sa: SocketAddr) -> TcpStream ! NetErrorconnect to sa (client)
listen
Section titled “listen”pub listen :: fn(sa: SocketAddr) -> TcpListener ! NetErrorbind + listen on sa, backlog 16
resolve
Section titled “resolve”pub resolve :: fn(a: *Arena, host: []const u8) -> addr::IpV4 ! NetErroripv4 of host: dotted, localhost, or looked up (after init); files read into a
windows: system resolver; linux: /etc/hosts, then resolv.conf servers, 2 s each
connect_host
Section titled “connect_host”pub connect_host :: fn(a: *Arena, host: []const u8, port: u16) -> TcpStream ! NetErrorresolve host, connect at port
udp_bind
Section titled “udp_bind”pub udp_bind :: fn(sa: SocketAddr) -> UdpSocket ! NetErrorUdpSocket bound to sa