A module zsh/net/tcp
is provided to provide network I/O over
TCP/IP from within the shell; see its description in
Zsh Modules. This manual page describes a function suite based on the module.
If the module is installed, the functions are usually installed at the
same time, in which case they will be available for
autoloading in the default function search path. In addition to the
zsh/net/tcp
module, the zsh/zselect
module is used to implement
timeouts on read operations. For troubleshooting tips, consult the
corresponding advice for the zftp
functions described in
Zftp Function System.
There are functions corresponding to the basic I/O operations open, close,
read and send, named tcp_open
etc., as well as a function
tcp_expect
for pattern match analysis of data read as input. The
system makes it easy to receive data from and send data to multiple named
sessions at once. In addition, it can be linked with the shell’s line
editor in such a way that input data is automatically shown at the
terminal. Other facilities available including logging, filtering and
configurable output prompts.
To use the system where it is available, it should be enough to
‘autoload -U tcp_open
’ and run tcp_open
as documented below to
start a session. The tcp_open
function will autoload the remaining
functions.