xref: /netbsd-src/sbin/mount_portal/examples/tcp.1 (revision 33078560c6c0154f0fc6bc3bf7ff4ac8dab6bcd2)
1*33078560Skamil$NetBSD: tcp.1,v 1.3 2017/05/09 23:26:49 kamil Exp $
2*33078560Skamil
3854e99c5SbgraysonUse the following configuration file, tcp.1.conf:
4854e99c5Sbgrayson
5854e99c5Sbgraysontcp/	tcp	tcp/
6854e99c5Sbgrayson
7854e99c5SbgraysonNow mount it, and cat the contents of /p/tcp/localhost/daytime:
8854e99c5Sbgrayson% mkdir portal
9854e99c5Sbgrayson% mount_portal /usr/share/examples/mount_portal/tcp.1.conf `pwd`/portal
10854e99c5Sbgrayson% cat portal/tcp/localhost/daytime
11854e99c5SbgraysonThu Aug  5 23:31:21 1999
12854e99c5Sbgrayson
13854e99c5SbgraysonPhilosophy:  With a pathname of <path to mountpount>/tcp/a/b[/priv],
14854e99c5Sbgraysonthe portal daemon opens a connection to host a, port b.  If /priv
15854e99c5Sbgraysonis specified, the socket will be created via rresvport(), rather
16854e99c5Sbgraysonthan socket().
17854e99c5Sbgrayson
18854e99c5SbgraysonFor the above example, we open a connection to the daytime port
19854e99c5Sbgrayson(port 13, according to /etc/services), and read data.
20854e99c5Sbgrayson
21854e99c5Sbgrayson
22854e99c5SbgraysonAdvanced usage:  finger
23854e99c5SbgraysonUsing the already-mounted portal file system, open a connection
24854e99c5Sbgraysonto the finger daemon, and do a finger.  Use the simple C program
25854e99c5Sbgraysonin fing.c in this directory.
26854e99c5Sbgrayson
27854e99c5Sbgrayson% make fing
28854e99c5Sbgraysoncc -O2   -o fing fing.c
29854e99c5Sbgrayson% fing
30854e99c5SbgraysonLogin    Name                 Tty  Idle  Login Time   Office Office Phone
31854e99c5Sbgraysonbgrayson Brian C. Grayson      p0     -  Thu 22:31    ENS406
32854e99c5Sbgraysonbgrayson Brian C. Grayson      p1    10  Thu 22:32    ENS406
33854e99c5Sbgraysonbgrayson Brian C. Grayson      p2     -  Thu 23:20    ENS406
34854e99c5Sbgrayson% fing root
35854e99c5SbgraysonLogin: root                             Name: Root @ marvin
36854e99c5SbgraysonDirectory: /root                        Shell: /bin/tcsh
37854e99c5SbgraysonLast login Wed Aug  4 18:11 (CDT) on ttyp1 from c3p0.ece.utexas.
38854e99c5Sbgrayson...
39854e99c5Sbgrayson
40854e99c5SbgraysonPhilosophy:  fing.c opens portal/tcp/localhost/finger as a
41854e99c5Sbgraysonread-write file.  First, we write the username for the finger (or
42854e99c5Sbgraysona blank line to see all users), then we read the results sent
43854e99c5Sbgraysonover the socket.
44