11.3Skamil$NetBSD: tcp.1,v 1.3 2017/05/09 23:26:49 kamil Exp $
21.3Skamil
31.1SbgraysonUse the following configuration file, tcp.1.conf:
41.1Sbgrayson
51.1Sbgraysontcp/	tcp	tcp/
61.1Sbgrayson
71.1SbgraysonNow mount it, and cat the contents of /p/tcp/localhost/daytime:
81.1Sbgrayson% mkdir portal
91.1Sbgrayson% mount_portal /usr/share/examples/mount_portal/tcp.1.conf `pwd`/portal
101.1Sbgrayson% cat portal/tcp/localhost/daytime
111.1SbgraysonThu Aug  5 23:31:21 1999
121.1Sbgrayson
131.1SbgraysonPhilosophy:  With a pathname of <path to mountpount>/tcp/a/b[/priv],
141.1Sbgraysonthe portal daemon opens a connection to host a, port b.  If /priv
151.1Sbgraysonis specified, the socket will be created via rresvport(), rather
161.1Sbgraysonthan socket().
171.1Sbgrayson
181.1SbgraysonFor the above example, we open a connection to the daytime port
191.1Sbgrayson(port 13, according to /etc/services), and read data.
201.1Sbgrayson
211.1Sbgrayson
221.1SbgraysonAdvanced usage:  finger
231.1SbgraysonUsing the already-mounted portal file system, open a connection
241.1Sbgraysonto the finger daemon, and do a finger.  Use the simple C program
251.1Sbgraysonin fing.c in this directory.
261.1Sbgrayson
271.1Sbgrayson% make fing
281.2Swizcc -O2   -o fing fing.c
291.1Sbgrayson% fing
301.1SbgraysonLogin    Name                 Tty  Idle  Login Time   Office Office Phone
311.2Swizbgrayson Brian C. Grayson      p0     -  Thu 22:31    ENS406
321.2Swizbgrayson Brian C. Grayson      p1    10  Thu 22:32    ENS406
331.2Swizbgrayson Brian C. Grayson      p2     -  Thu 23:20    ENS406
341.1Sbgrayson% fing root
351.1SbgraysonLogin: root                             Name: Root @ marvin
361.1SbgraysonDirectory: /root                        Shell: /bin/tcsh
371.1SbgraysonLast login Wed Aug  4 18:11 (CDT) on ttyp1 from c3p0.ece.utexas.
381.1Sbgrayson...
391.1Sbgrayson
401.1SbgraysonPhilosophy:  fing.c opens portal/tcp/localhost/finger as a
411.1Sbgraysonread-write file.  First, we write the username for the finger (or
421.1Sbgraysona blank line to see all users), then we read the results sent
431.1Sbgraysonover the socket.
44