From a3eba146fd90cc9e93e721004d0e93a22541efa4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Lindqvist?= Date: Thu, 12 Sep 2013 15:46:01 +0200 Subject: [PATCH] io.sockets: example for the with-socket function --- basis/io/sockets/sockets-docs.factor | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/basis/io/sockets/sockets-docs.factor b/basis/io/sockets/sockets-docs.factor index 9ef728170b..a83465f009 100644 --- a/basis/io/sockets/sockets-docs.factor +++ b/basis/io/sockets/sockets-docs.factor @@ -154,7 +154,16 @@ HELP: HELP: with-client { $values { "remote" "an address specifier" } { "encoding" "an encoding descriptor" } { "quot" quotation } } { $description "Opens a network connection and calls the quotation in a new dynamic scope with " { $link input-stream } " and " { $link output-stream } " rebound to the network streams. The local address the socket is connected to is stored in the " { $link local-address } " variable, and the remote address is stored in the " { $link remote-address } " variable." } -{ $errors "Throws an error if the connection cannot be established." } ; +{ $errors "Throws an error if the connection cannot be established." } +{ $examples + { $code + "T{ inet f \"www.factorcode.org\" 80 } ascii" + "[" + " \"GET / HTTP/1.1\\r\\nhost: www.factorcode.org\\r\\n\\r\\n\" write flush" + " read-?crlf" + "] with-client" + } +} ; HELP: { $values { "addrspec" "an address specifier" } { "encoding" "an encoding descriptor" } { "server" "a handle" } }