net - TCP and UDP sockets, in the shape of Go's net package.
Everything goes through syscall, there is no dependency on the C library of the host. Addresses are written "host:port", an empty host meaning every interface.
¶JoinHostPort = fn(host, port)source
JoinHostPort builds an address out of a host and a port.
¶SplitHostPort = fn(hostport)source
SplitHostPort returns an object with Host and Port, or an error if the address carries no port. The last colon wins, so IPv6 forms survive.
¶Host = slice(hostport, 0, colon)valuesource
¶Port = portvaluesource
¶Dial = fn(network, address)source
Dial connects to an address. Network is "tcp" or "udp".
¶RemoteAddr = raddrvaluesource
¶Read = fn(n)source
Read returns up to n bytes, or an empty bytes value when the other end has closed the connection.
¶Write = fn(data)source
Write sends a string or bytes and returns how many bytes went out.
¶Close = fn()source
¶SetTimeout = fn(ms)source
SetTimeout gives up on a read or a write after ms milliseconds.
¶Listen = fn(network, address)source
Listen returns a listener accepting connections on address.
¶Accept = fn()source
Accept waits for the next connection.
¶RemoteAddr = raddrvaluesource
¶Read = fn(n)source
Read returns up to n bytes, or an empty bytes value when the other end has closed the connection.
¶Write = fn(data)source
Write sends a string or bytes and returns how many bytes went out.
¶Close = fn()source
¶SetTimeout = fn(ms)source
SetTimeout gives up on a read or a write after ms milliseconds.
¶Close = fn()source
¶ListenPacket = fn(network, address)source
ListenPacket returns a UDP socket bound to address.
¶Addr = addressvaluesource
¶ReadFrom = fn(n)source
ReadFrom returns an object with Data and Addr, the sender of the packet.
¶Data = slice(buf, 0, read)valuesource
¶Addrvaluesource
¶WriteTo = fn(data, address)source
WriteTo sends a packet to address.
¶Close = fn()source
¶ParseIP = fn(s)source
ParseIP reports whether s is a valid dotted IPv4 address, returning it.
¶LookupPort = fn(network, service)source
LookupPort returns the port of a well known service, or the number itself.