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