shithub: riscv

ref: e5c7fe6305977d4135d56d2fa6b5b37c8f275679
dir: /sys/man/8/listen/

View raw version
.TH LISTEN 8
.SH NAME
listen, listen1, tcp7, tcp9, tcp19, tcp21, tcp23, tcp25, tcp53, tcp110, tcp113, tcp143, tcp445, tcp513, tcp515, tcp564, tcp565, tcp566, tcp567, tcp993, tcp995, tcp1723, tcp17019, tcp17020 \- listen for calls on a network device
.SH SYNOPSIS
.B aux/listen
.RB [ -iq ]
.RB [ -d
.IR srvdir ]
.RB [ -t
.IR trustsrvdir ]
.RB [ -n
.IR namespace ]
.RB [ -p
.IR maxprocs ]
.RB [ -o
.IR copt ]
.RB [ -O
.IR sopt ]
.RB [ -a
.IR addr ]
.RI [ proto ]
.PP
.B aux/listen1
[
.B -1tv
]
.RB [ -n
.IR namespace ]
.RB [ -p
.IR maxprocs ]
.RB [ -o
.IR copt ]
.RB [ -O
.IR sopt ]
.I addr
.I cmd
[
.I args...
]
.SH DESCRIPTION
.I Listen
listens on a network for inbound calls to local services.
.I Proto
is the network protocol on which to listen, by default
.BR tcp .
Incoming calls to any address
.B *
are accepted unless
.I addr
is specified with the
.B -a
option. 
The services available are executable, non-empty files in
.I srvdir
or
.IR trustsrvdir .
If neither
.I srvdir
nor
.I trustsrvdir
is given,
.I listen
looks for executable files in
.BR /bin/service .
Services found in
.I srvdir
are executed as user
.BR none ;
services found in
.I trustsrvdir
are executed as the user who started
.IR listen .
When changing user to
.BR none ,
a new namespace is created,
usually by executing
.BR /lib/namespace ,
but
.B -n
selects an alternate
.IR namespace .
The
.B -p
option limits the number of processes that
.I listen
spawns to service the connections. If the
.I maxprocs
limit is reached,
.I listen
will log the event and delay servicing until the number
of connection processes drops below the limit again. A
.I maxprocs
smaller or equal zero means no limit (default).
The
.B -o
and
.B -O
options cause protocol-specific control messages
to be written to the control file of the listening
server connection
.B -O
or the incoming client
connection
.BR -o .
They can be specified multiple
times. See
.IR ip (3)
for details.
Option
.B -q
suppresses affirmative log information.
Option
.B -i
suppresses the periodic scan of the service directories for changes.
.PP
Service names are made by concatenating the name of
the network with the name of the service or port.
For example,
an inbound call on the TCP network for port 565 executes service
.BR tcp565 .
.PP
Services may have individual
.IR namespace (6)
files specified within
.IR srvdir .
If provided, the namespace is used as the parent for each connection
to the corresponding service. Namespace files are found by appending a .namespace
suffix to the service name.
.PP
At least the following services are available in
.BR /bin/service .
.TF \ tcp0000
.TP
.B tcp564
serve a piece of the name space using the Plan 9 file system protocol,
with authentication via
.I Tauth
(in
.IR attach (5)),
no encryption,
and multiplex multiple users on a single connection
(used by
.IR srv (4),
and also by Unix systems to see Plan 9 files).
.TP
.B tcp17019
server for
.IR rcpu (1),
replaces
.IR rx ,
.IR import
and
.IR cpu
using TLS for encryption. 
.TP
.B tcp17020
TLS encrypted 9P fileserver (t9fs) for
.I srvtls
(see
.IR srv (4)).
.TP
.B tcp7
echo any bytes received (bit mirror)
.TP
.B tcp9
consume any bytes received (bit bucket)
.TP
.B tcp19
.B chargen
service.
.TP
.B tcp21
FTP daemon
.TP
.B tcp23
.B telnet
terminal connection.
.TP
.B tcp25
mail delivery.
.TP
.B tcp53
TCP port for DNS.
.TP
.B tcp110
POP3 port.
.TP
.B tcp113
.B Ident
port (always reports
.BR none ).
.TP
.B tcp143
IMAP4rev1 port.
.TP
.B tcp445
CIFS/SMB file sharing.
.TP
.B tcp513
.B rlogin
terminal connection.
.TP
.B tcp515
LP daemon; see
.IR lp (8).
.TP
.B tcp565
report the address of the incoming call.
.TP
.B tcp993
Secure IMAP4rev1 port.
.TP
.B tcp995
Secure POP3 port.
.TP
.B tcp1723
PPTP (point-to-point tunnelling protocol) service.
.PD
.PP
At least the following services are available in
.BR /bin/service.auth ,
the usual
.IR trustsrvdir .
.TF \ tcp0000
.TP
.B tcp566
validate a SecureNet box.
.TP
.B tcp567
Plan 9 authentication-ticket service.
.PD
.PP
.I Listen1
is a lightweight listener intended for personal use,
modeled from Inferno's
.\" write out this way so automatic programs
.\" don't try to make it into a real man page reference.
\fIlisten\fR(1).
It announces on
.IR address ,
running
.I cmd
.I args...
for each incoming connection;
the network directory is passed in the environment
as 
.BR $net .
Option
.B -t
causes
.I listen1
to run as the invoking user; the default
is to become
.B none
before listening.
Option
.B -1
arms a one-shot listener; it terminates listen1
upon receiving a single call.
Option
.B -v
causes verbose logging on standard output.
See
.B /rc/bin/tlssrvtunnel
for an example.
.SH FILES
.TF /env/sysname
.TP
.B /net/tcp
by convention, TCP device bind point
.SH SOURCE
.B /sys/src/cmd/aux/listen*.c
.br
.B /rc/bin/service*
.SH "SEE ALSO"
.IR authsrv (6),
.IR dial (2),
.IR ip (3)
.SH BUGS
.IR Srvdir ,
.IR trustsrvdir
and
.I namespace
must all be absolute path names.