Domain = enum
AF_UNSPEC = 0, ## unspecified domain (can be detected automatically by
## some procedures, such as getaddrinfo)
AF_UNIX = 1, ## for local socket (using a file). Unsupported on Windows.
AF_INET = 2, ## for network protocol IPv4 or
AF_INET6 = 23
domain, which specifies the protocol family of the created socket. Other domains than those that are listed here are unsupported. SourceEdit
Protocol = enum
IPPROTO_TCP = 6, ## Transmission control protocol.
IPPROTO_UDP = 17, ## User datagram protocol.
IPPROTO_IP, ## Internet protocol.
IPPROTO_IPV6, ## Internet Protocol Version 6.
IPPROTO_RAW, ## Raw IP Packets Protocol. Unsupported on Windows.
IPPROTO_ICMP, ## Internet Control message protocol.
IPPROTO_ICMPV6 ## Internet Control message protocol for IPv6.
Searches the database from the beginning and finds the first entry for which the service name specified by name matches the s_name member and the protocol name specified by proto matches the s_proto member.
On posix this will search through the /etc/services file.
Searches the database from the beginning and finds the first entry for which the port specified by port matches the s_port member and the protocol name specified by proto matches the s_proto member.
On posix this will search through the /etc/services file.
Converts 32-bit unsigned integers from network to host byte order. On machines where the host byte order is the same as network byte order, this is a no-op; otherwise, it performs a 4-byte swap operation. SourceEdit
Converts 16-bit unsigned integers from network to host byte order. On machines where the host byte order is the same as network byte order, this is a no-op; otherwise, it performs a 2-byte swap operation. SourceEdit
proc selectRead(readfds: var seq[SocketHandle]; timeout = 500): int {.
...raises: [], tags: [], forbids: [].}
When a socket in readfds is ready to be read from then a non-zero value will be returned specifying the count of the sockets which can be read from. The sockets which cannot be read from will also be removed from readfds.
timeout is specified in milliseconds and -1 can be specified for an unlimited time.
proc selectWrite(writefds: var seq[SocketHandle]; timeout = 500): int {.
...tags: [ReadIOEffect], raises: [], forbids: [].}
When a socket in writefds is ready to be written to then a non-zero value will be returned specifying the count of the sockets which can be written to. The sockets which cannot be written to will also be removed from writefds.
timeout is specified in milliseconds and -1 can be specified for an unlimited time.
Converts 32-bit unsigned integers from host to network byte order. On machines where the host byte order is the same as network byte order, this is a no-op; otherwise, it performs a 4-byte swap operation. SourceEdit
template htons(x: uint16): untyped
Converts 16-bit unsigned integers from host to network byte order. On machines where the host byte order is the same as network byte order, this is a no-op; otherwise, it performs a 2-byte swap operation. SourceEdit