source: trunk/minix/man/man1/rget.1@ 15

Last change on this file since 15 was 9, checked in by Mattia Monga, 14 years ago

Minix 3.1.2a

File size: 4.4 KB
Line 
1.TH RGET 1
2.SH NAME
3rget, rput \- network pipe
4.SH SYNOPSIS
5.B rget
6.RB [ \-lcio ]
7.RB [ \-h
8.IR host ]
9.I key
10.RI [ command
11.RI [ arg " ...]]"
12.br
13.B rput
14.RB [ \-lcio ]
15.RB [ \-h
16.IR host ]
17.I key
18.RI [ command
19.RI [ arg " ...]]"
20.SH DESCRIPTION
21.de SP
22.if t .sp 0.4
23.if n .sp
24..
25.de XS \" Example start
26.SP
27.in +4m
28.nf
29..
30.de XE \" Example end
31.fi
32.in -4m
33.SP
34..
35.B Rput
36and
37.B rget
38set up a TCP/IP channel to connect two processes together. They can looked
39upon as a remote pipe. Consider the well known method of copying a
40directory tree with
41.BR tar :
42.XS
43(cd src && tar cf \- .) | (cd dst && tar xfp \-)
44.XE
45If the directory tree is to be copied to another machine then one can
46use the following command on the source machine:
47.XS
48cd src && rput foo tar cf \- .
49.XE
50And on the destination machine:
51.XS
52cd dst && rget \-h \fIsource-machine\fP foo tar xfp \-
53.XE
54The
55.I key
56is either a port number in C style decimal, octal or hex, or a random string
57that is hashed to a port number.
58.B Rput
59uses this port number to open a TCP socket that
60.B rget
61using the same
62.I key
63can connect to.
64It is customary to start
65.B rput
66first, although
67.B rget
68will retry for 2 minutes trying to connect to the remote
69.BR rput.
70.PP
71After the connection is established either utility will execute
72.I command
73with the given arguments with the TCP channel as either standard output
74(rput) or standard input (rget).
75.B Rput
76and
77.B rget
78do not stay around for the command to finish, they simply overlay themselves
79with the command. If no command is given then they will themselves copy
80standard input into the TCP channel (rput), or output from the TCP channel
81to standard output (rget). So these two commands have the same effect:
82.XS
83rput foo tar cf \- .
84tar cf \- . | rput foo
85.XE
86The second form has two processes copying data instead of just
87.B tar
88directly writing its output into the TCP channel. There is a better way to
89waste processor cycles, namely to save bandwidth:
90.XS
91cd src && tar cf \- . | rput foo compress
92.SP
93cd dst && rget \-h \fIsource-machine\fP foo uncompress | tar xfp \-
94.XE
95.B Rput
96and
97.B rget
98can be very useful in the windowed environments we use these days. The
99.B rput
100can be typed into the window that has a shell running on one machine, and
101the
102.B rget
103is then typed into the window that has a shell running on another machine.
104This is easier than one of the two well known forms that use
105.BR rsh :
106.XS
107cd src && tar cf \- . | rsh dest-machine "cd dst && tar xfp \-"
108.SP
109cd dst && rsh source-machine "cd src && tar cf \- ." | tar xfp \-
110.XE
111Especially since these forms require that one must be able to use
112.B rsh
113without a password, which may not always be the case.
114.PP
115The
116.I key
117can be any string of characters of any length. If its a number then it is
118used directly as the port number. Otherwise the characters binary values
119are multiplied together, bit 15 is set and the result is truncated to 16
120bits to make it a port number in the anonymous port space (32768 \- 65535).
121The port may be in-use on the source machine, but there is a small chance
122of this happening, and if so simply choose another key. (So if you use
123.B rput
124and
125.B rget
126in an unattended script then you should reserve a port number, otherwise
127a connection can't be guaranteed.)
128.SH OPTIONS
129.TP
130.B \-lcio
131These flags allow one to reverse the default connect/listen or input/output
132direction of
133.BR rput
134and
135.BR rget .
136Reversing the connection may be necessary if one of the two systems filters
137out connections to unknown ports. For example:
138.XS
139rput \-c \-h \fIdestination-machine\fP foo tar cf \- .
140.SP
141rget \-l foo tar xfp \-
142.XE
143The
144.B \-io
145options can be used to choose which of standard input or output should be
146tied to the socket. It's even possible to tie both input and output to the
147socket with
148.BR \-io,
149but only when executing a command. This is probably the only use for these
150options, because one usually chooses the direction with the mnemonic put/get
151names.
152.TP
153.BI \-h " host"
154The name of the remote host that a connection must be made to. It must be
155used with the program that is doing the connect, usually
156.BR rget .
157This option is currently mandatory. The author is planning to increase
158ease of use by letting the programs find each other with UDP broadcasts
159or multicasts.
160.SH "SEE ALSO"
161.BR rsh (1).
162.SH DIAGNOSTICS
163.TP 5
164rput: Address in use
165If the port computed out of
166.I key
167is already in use.
168.SH AUTHOR
169Kees J. Bot <kjb@cs.vu.nl>
Note: See TracBrowser for help on using the repository browser.