1$NetBSD: tcp.1,v 1.3 2017/05/09 23:26:49 kamil Exp $
2
3Use the following configuration file, tcp.1.conf:
4
5tcp/	tcp	tcp/
6
7Now mount it, and cat the contents of /p/tcp/localhost/daytime:
8% mkdir portal
9% mount_portal /usr/share/examples/mount_portal/tcp.1.conf `pwd`/portal
10% cat portal/tcp/localhost/daytime
11Thu Aug  5 23:31:21 1999
12
13Philosophy:  With a pathname of <path to mountpount>/tcp/a/b[/priv],
14the portal daemon opens a connection to host a, port b.  If /priv
15is specified, the socket will be created via rresvport(), rather
16than socket().
17
18For the above example, we open a connection to the daytime port
19(port 13, according to /etc/services), and read data.
20
21
22Advanced usage:  finger
23Using the already-mounted portal file system, open a connection
24to the finger daemon, and do a finger.  Use the simple C program
25in fing.c in this directory.
26
27% make fing
28cc -O2   -o fing fing.c
29% fing
30Login    Name                 Tty  Idle  Login Time   Office Office Phone
31bgrayson Brian C. Grayson      p0     -  Thu 22:31    ENS406
32bgrayson Brian C. Grayson      p1    10  Thu 22:32    ENS406
33bgrayson Brian C. Grayson      p2     -  Thu 23:20    ENS406
34% fing root
35Login: root                             Name: Root @ marvin
36Directory: /root                        Shell: /bin/tcsh
37Last login Wed Aug  4 18:11 (CDT) on ttyp1 from c3p0.ece.utexas.
38...
39
40Philosophy:  fing.c opens portal/tcp/localhost/finger as a
41read-write file.  First, we write the username for the finger (or
42a blank line to see all users), then we read the results sent
43over the socket.
44