{ $description "Waits up to " { $snippet "ms" } " milliseconds for pending I/O requests to complete." }
{ $warning "If an I/O request completes during the time period, its continuation is resumed and the current one is not saved. If you need to delay execution for a period of time, use the higher-level " { $link sleep } " word instead." } ;
{ $errors "Throws an error if domain name lookup fails, or if there is a connection cannot be established." } ;
HELP: <server> "( port -- server )"
{ $values { "port" "an integer between 0 and 65535" } { "server" "a handle" } }
{ $description
"Begins listening for connections to " { $snippet "port" } " on all network interfaces. The returned object responds to two generic words:"
{ $list
{ { $link stream-close } " - stops listening on the port and frees all associated resources" }
{ { $link accept } " - blocks until there is a connection" }
}
}
{ $errors "Throws an error if the port is already in use, or if the OS forbits access." } ;
HELP: accept "( server -- stream )"
{ $values { "server" "a handle" } { "stream" "a bidirectional stream" } }
{ $description "Waits for a connection to a server socket created by " { $link <server> } ", and outputs a bidirectional stream when the connection has been established."
$terpri
"The client socket supports two accessor words to get the host name and port number of the incoming connection:"