From bfac2554b50c7812b86136aa52c43bc978750ba7 Mon Sep 17 00:00:00 2001 From: Simon Shanks Date: Mon, 24 Jun 2024 09:30:08 +0100 Subject: [PATCH] moved details into hopen section --- docs/ref/hopen.md | 78 +++++++++++++++++++++++------------------------ 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/docs/ref/hopen.md b/docs/ref/hopen.md index 39066f0cd..0f13bf50e 100644 --- a/docs/ref/hopen.md +++ b/docs/ref/hopen.md @@ -58,42 +58,7 @@ hopen each(`:mysymbol; (":localhost:5000";1000)) ``` - -## :fontawesome-solid-handshake-slash: `hclose` - -_Close a connection to a file or process_ - -```syntax -hclose x hclose[x] -``` - -Where `x` is a connection handle, closes the connection, and destroys the handle. -The corresponding integer can then no longer be applied to an argument. - -```q -q)show h:hopen `::5001 -3i -q)h"til 5" -0 1 2 3 4 -q)hclose h -q)h"til 5" -': Bad file descriptor -``` - -Async connections: pending data on the connection handle is not sent prior to closing. -If flushing is required prior to close, this must be done explicitly. -(Since V3.6 2019.09.19) - -```q -q)neg[h][];hclose h; -``` - -!!! info "`hclose` before V3.6 2019.09.19" - - If the handle refers to a WebSocket, `hclose` blocks until any pending data on the connection handle has been sent. - - -## :fontawesome-solid-database: Files +### :fontawesome-solid-database: Files If a filehandle specifies a non-existent filepath, it is created, including directories. @@ -117,9 +82,9 @@ q)r:htxt ` sv("asdf";"qwer") ``` -## :fontawesome-solid-handshake: Processes +### :fontawesome-solid-handshake: Processes -### Communication handles +#### Communication handles A communication handle specifies a network resource, and may include authentication credentials for it. There are four forms. @@ -164,7 +129,7 @@ q)(neg h)"a:2" / asynchronous (SET) ``` -### :fontawesome-solid-thumbs-up: One-shot request +#### :fontawesome-solid-thumbs-up: One-shot request If only one synchronous query/request is to be run, then the one-shot synchronous request can be used to connect, send the query, get the results, then disconnect. @@ -184,6 +149,41 @@ One-shot sync queries can now execute via `` `::[(":host:port";timeout);query]`` `":host:port"` can also be a symbol as `` `:host:port``. + +## :fontawesome-solid-handshake-slash: `hclose` + +_Close a connection to a file or process_ + +```syntax +hclose x hclose[x] +``` + +Where `x` is a connection handle, closes the connection, and destroys the handle. +The corresponding integer can then no longer be applied to an argument. + +```q +q)show h:hopen `::5001 +3i +q)h"til 5" +0 1 2 3 4 +q)hclose h +q)h"til 5" +': Bad file descriptor +``` + +Async connections: pending data on the connection handle is not sent prior to closing. +If flushing is required prior to close, this must be done explicitly. +(Since V3.6 2019.09.19) + +```q +q)neg[h][];hclose h; +``` + +!!! info "`hclose` before V3.6 2019.09.19" + + If the handle refers to a WebSocket, `hclose` blocks until any pending data on the connection handle has been sent. + + ---- :fontawesome-solid-book: [`.Q.Xf`](dotq.md#xf-create-file) (create file)