home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS - Coast to Coast / simteldosarchivecoasttocoast2.iso / ncsatlnt / tel23doc.zip / CHAP.5 < prev    next >
Text File  |  1991-07-01  |  19KB  |  573 lines

  1. 5.1    NCSA Telnet
  2.  
  3.  
  4. File Transfer    5.1
  5.  
  6.  
  7. National Center for Supercomputing Applications
  8.  
  9.  
  10. June 1991
  11.  
  12.  
  13.                                                                 
  14.  
  15.  
  16.  
  17.  
  18.  
  19. 5.1    NCSA Telnet
  20.  
  21. File Transfer    5.1
  22.  
  23. National Center for Supercomputing Applications
  24.  
  25. June 1991
  26.  
  27.  
  28.  
  29.  
  30.     6/30/91
  31.  
  32.  
  33.  
  34.  
  35. Chapter 5    File Transfer
  36.  
  37.  
  38.  
  39. Chapter Overview
  40. File Transfer Terminology
  41. File Transfer Guidelines
  42. Full Path Specification:  Conversion of Forward 
  43. Slashes
  44. Simultaneous Activity 
  45. Rules for Filenames Sent to the PC
  46. File Transfer Reports
  47. File Transfer Using FTP
  48. Setting Up FTP
  49. Using FTP
  50. Invoking FTP on the Host Computer
  51. Invoking FTP Using Alternate Methods
  52. Using FTP Commands
  53. File Transfer Using rcp
  54. Setting Up rcp
  55. Using rcp
  56. Avoiding Use of NCSA Telnet's rcp Server
  57. Using rcp Between the PC and UNIX
  58. Using Wildcards
  59.  
  60. Chapter Overview
  61.  
  62. This chapter describes procedures for transferring files between a 
  63. PC and a network host, using NCSA Telnet's two built-in file 
  64. transfer servers: FTP and rcp. Guidelines and information are 
  65. presented for file name conventions, path specification, and 
  66. background file transfer.
  67.  
  68.  
  69. File Transfer Terminology
  70.  
  71. This chapter uses the following terms:
  72.  
  73.  
  74. ASCII file, text file
  75. Humans can read an ascii or text file, and can edit the files using 
  76. standard editors on the PC or host. When you transfer text files, 
  77. their end-of-line markers are changed.
  78.  
  79.  
  80. Binary, Graphics, or Image File
  81. Humans can't read a binary, graphics, or image file. 
  82. When transferred, binary files are not changed in any way 
  83. (unlike text files).
  84.  
  85.  
  86. Client/Server
  87. The client is the system that requests services while the server is 
  88. the system that provides or "serves" them. The client is not always 
  89. your PC, despite appearances. When you use NCSA Telnet to 
  90. connect to a host, your PC is the telnet client. When you request a 
  91. file transfer from your PC, the transfer is actually initiated on the 
  92. host, making the host the FTP client and your PC the FTP server. 
  93. Thus, the PC is a telnet client and an FTP server at the same time. 
  94.  
  95.  
  96. File Transfer
  97. In a file transfer, the contents of a file are copied, and the copy is 
  98. placed on another computer's disk drive.
  99.  
  100.  
  101. File Transfer Guidelines
  102.  
  103. Full Path Specification: 
  104. Conversion of Forward 
  105. Slashes
  106. If you do not specify a full pathname for either FTP or rcp, NCSA 
  107. Telnet will transfer the files to the default directory. If you need to 
  108. specify a different directory, type the full pathname as documented 
  109. in the DOS manual. The full pathname may include the disk drive 
  110. name, with a colon. For example:
  111.  
  112. D:\myfiles\graphics\image.dat
  113.  
  114. or
  115.  
  116. D:/myfiles/graphics/image.dat
  117.  
  118. You may use forward slashes (/) rather than backslashes (\), 
  119. because NCSA Telnet automatically converts any forward slashes 
  120. in UNIX pathnames to backslashes for compatibility with PC-DOS. 
  121. Because backslashes are special characters in the UNIX shell and 
  122. a special format is required to enter them, forward slashes are 
  123. more convenient to use.
  124.  
  125. NOTE:  rcp is a Berkeley UNIX feature. Refer to the section, 
  126. "Using rcp File Transfer," in this chapter for more information.
  127.  
  128.  
  129. Simultaneous Activity 
  130. With both FTP and rcp, file transfers are processed at the same 
  131. time as other telnet sessions. Therefore, while a file transfer is in 
  132. progress, you can perform other NCSA Telnet activities such as 
  133. interacting with a telnet session, switching sessions, adding new 
  134. sessions, or changing parameters. 
  135.  
  136. However, do not initiate another file transfer while one is already 
  137. in progress. While an FTP request is being processed, a second 
  138. FTP request will be ignored. Furthermore, if you try to start an rcp 
  139. transfer while another transfer is already underway, both 
  140. transfers may fail.
  141.  
  142. NOTE: Do not quit NCSA Telnet while a file transfer is in 
  143. progress, because the file transfer may fail.
  144.  
  145.  
  146. Rules for Filenames Sent to 
  147. the PC
  148. Whether you are using FTP or rcp to transfer files to or from a PC, 
  149. check these rules for PC filenames:
  150.  
  151. Ñ    A legal PC filename is eight characters or less, followed by an 
  152. optional period and an up to three-character extension.
  153.  
  154. Ñ    Upper and lower case are considered identical for filenames on 
  155. PC disks.
  156.  
  157. Ñ    Names of files which are transferred from the PC are given in 
  158. all lower case.
  159.  
  160. Ñ    A filename longer than eight characters is truncated.
  161.  
  162. Ñ    If a period occurs in a filename, the next three characters are 
  163. read as the extension, and any others are truncated. 
  164.  
  165. Ñ    A filename should not contain "special characters" or spaces. 
  166. If it does, the file may be lost or unreadable. Examples of special 
  167. characters are the asterisk (*), the dollar sign ($), the pound 
  168. sign (#), the hyphen (-), and control characters. 
  169.  
  170.  
  171. File Transfer Reports
  172. The FTP server produces several kinds of information for you to 
  173. help keep tabs on FTP access to the local hard disk. You can view 
  174. this information by pressing the ALT-Z keys (show console 
  175. messages), as documented in Chapter 2, "Introduction to 
  176. Managing Sessions." The following list describes the 
  177. information which FTP provides.
  178.  
  179. Ñ    Reports when a command connection is initiated, with the IP 
  180. address or host name of the remote machine which initiated the 
  181. connection
  182.  
  183. Ñ    Reports the name of the user who logs in, if you use the USER 
  184. command
  185.  
  186. Ñ    Reports the file names which were transferred to or from local 
  187. disk
  188.  
  189. Ñ    Reports when the command connection ends
  190.  
  191. The rcp server also produces reports for the console screen.
  192.  
  193. Ñ    Reports when an rcp transfer begins
  194. Ñ    Reports when the rcp transfer ends
  195.  
  196.  
  197. File Transfer Using FTP
  198.  
  199. The FTP server in NCSA Telnet is the minimum standard FTP 
  200. server, similar to that in 4.2 BSD UNIX. NCSA's FTP supports the 
  201. following features:
  202.  
  203. Ñ    Stream transfer in text format (ASCII) or binary format 
  204. (IMAGE)
  205.  
  206. Ñ    Change, create, or delete a directory
  207.  
  208. Ñ    Print current directory
  209.  
  210. Ñ    List files in current directory (with wildcard specifications)
  211.  
  212. Ñ    Send and receive multiple files with one command, using 
  213. wildcards
  214. Ñ    Delete file
  215.  
  216.  
  217. Setting Up FTP
  218. The host machine must support FTP file transfer. If you do not 
  219. know whether it does, see your system administrator.
  220.  
  221. You must not have disabled the file transfer capability of NCSA 
  222. Telnet. That is done with the Parameter menu (see Chapter 3, 
  223. "More About Managing Sessions"), or in the configuration file 
  224. (see Chapter 7, "Installation and Configuration"). If the file 
  225. transfer capability has been switched off, when you attempt to start 
  226. up FTP, you will get a message from the host to the effect that the 
  227. computer is not responding. If you get such a message, check the 
  228. file transfer mode on the Parameter menu to make sure that it is 
  229. enabled.
  230.  
  231.  
  232. Using FTP
  233. Use FTP rather than rcp in either of the following situations.
  234.  
  235. 1.    You are not thoroughly familiar with the host operating system. 
  236. FTP is easier to use than rcp, and requires less familiarity with 
  237. the host commands and directory structure.
  238.  
  239. 2.    You are transferring PC text (ASCII) files to a host. FTP is a 
  240. better choice than rcp, because FTP automatically converts the 
  241. end-of-line characters in text files from CRLF, used by PC-DOS, 
  242. to LF, used by UNIX machines.
  243.  
  244.  
  245. Invoking FTP on the Host 
  246. Computer
  247. FTP is initiated by the host, so the FTP commands vary, 
  248. depending on the host system. For full documentation of FTP and 
  249. commands within FTP, you must refer to the manuals for the host 
  250. computer. With UNIX systems, you can see online documentation 
  251. by using the man ftp command. See Chapter 4, "Utility 
  252. Programs," for more information.
  253.  
  254.  
  255. The FTP Command
  256. On most systems, the FTP command is entered at the prompt, with 
  257. the name or IP address of the target machine. For example, if your 
  258. PC is named "mymachine" and your IP address is 192.17.20.22, 
  259. then you might enter:
  260.  
  261. % ftp mymachine
  262.  
  263. or
  264.  
  265. % ftp 192.17.20.22
  266.  
  267. which generates a response like this:
  268.  
  269. Connected to 192.17.20.22.
  270. 220 PC Resident FTP server, ready
  271. Name (192.17.20.22:timk):
  272. Most FTP clients will now prompt you for your username and 
  273. password. If NCSA Telnet is configured for passwords (see 
  274. Chapter 7, "Installation and Configuration"), then these are 
  275. required. Otherwise, just press RETURN to bypass the prompts. If 
  276. you are  not prompted for username and password, then assume 
  277. that you are logged in and continue with your FTP commands.
  278.  
  279.  
  280. Invoking FTP Using 
  281. Alternate Methods
  282. The most common procedure for starting FTP uses the shortcut 
  283. keystroke, ALT-F. When you press ALT-F, NCSA Telnet types the 
  284. FTP command described above, automatically including your 
  285. PC's IP address and the RETURN to initiate the command. For 
  286. convenience, you will probably prefer ALT-F to the other ways of 
  287. entering the command. You may want to think of this as a 
  288. keyboard macro that is pre-set with the FTP command and your IP 
  289. address.
  290.  
  291. Another available macro is ALT-I which types your IP address for 
  292. you. When entering any networking command, FTP for example, 
  293. you can instantly produce your own network IP address with ALT-
  294. I. The following sequence is equivalent to pressing ALT-F.
  295.  
  296. ftp
  297. (SPACEBAR)
  298. (ALT-I)
  299. (RETURN)
  300.  
  301. Use whichever method of invoking FTP that works best for you. 
  302. Your host computer may or may not accept FTP commands as 
  303. described here, so you may have to try some variations to find the 
  304. easiest method for your site. Your system administrator may be 
  305. able to help.
  306.  
  307.  
  308. Using FTP Commands
  309. For most FTPs, after FTP has been invoked and passwords have 
  310. been checked, you are prompted for individual FTP commands. 
  311. These commands are also documented in the manuals for the host 
  312. computer. Most of the FTP implementations have similar 
  313. commands because they are modeled after the Berkeley UNIX 
  314. version of FTP. Table 5.1 lists FTP commands that are common to 
  315. most implementations.
  316.  
  317. Table 5.1    Common FTP 
  318. Commands
  319. Command        Action
  320.  
  321. ascii        Sets mode to ASCII transfer mode (default)
  322.  
  323. binary        Sets mode to binary (image) transfer mode
  324.  
  325. cd path        Sets a new default directory on PC
  326.  
  327. dir            Shows filenames in PC's default directory
  328.  
  329. get filename    Gets a file from PC and sends it to host
  330.  
  331. help            Shows online list of FTP commands
  332.  
  333. put filename    Sends a file from host to PC
  334.  
  335. pwd            Shows current PC directory name
  336.  
  337. quit            Exits FTP
  338.  
  339. remotehelp    Shows list of supported commands on FTP 
  340.                 server
  341.  
  342.  
  343. ASCII, Binary
  344. The default mode for FTP transfers is ASCII format. If you are 
  345. transferring graphics or binary data files, change to binary mode 
  346. before you use the put or get commands. Do this by entering the 
  347. command binary. To reset the ASCII format after sending a 
  348. binary file, enter the command ascii. Figure 5.1 shows an FTP 
  349. transaction with an ASCII file. Figure 5.2 shows an FTP 
  350. transaction with a binary file.
  351.  
  352.  
  353. Default Directory
  354. Unless you include a full pathname with the command, NCSA 
  355. Telnet transfers the file to the default directory. As Table 5.1 
  356. indicates, you can use FTP commands to identify the current 
  357. directory (pwd), or change the current directory (cd).
  358.  
  359. The change directory command, which you type as cd, allows you 
  360. to change the default disk drive in addition to the default directory. 
  361. Just use PC standard disk notation, with forward slashes instead 
  362. of backslashes, for example:
  363.  
  364. ftp> cd D:/files
  365.  
  366. The pwd command also returns disk information. After the 
  367. previous example cd command, a pwd command returns:
  368.  
  369. D:\FILES
  370.  
  371.  
  372. Transfer to the PC
  373. Even though you seem to be initiating the transfer from the PC, the 
  374. transaction operates from the host's side. The practical effect of 
  375. this could make the commands seem intuitively "backwards." To 
  376. transfer a file from the host to your PC, you use a put command. 
  377. The form this command takes is:
  378.  
  379. put filename.ext
  380.  
  381. Figure 5.1 shows an example of a put command used with an 
  382. actual file, named temp2. The boldface type represents user 
  383. entries.
  384.  
  385.  
  386. Figure 5.1    Put to the PC, ASCII 
  387. File
  388. newton_45% ftp -n 192.17.20.124
  389. Connected to 192.17.20.124.
  390. 220 PC Resident FTP server, ready
  391. ftp> put temp2
  392. 200 This space intentionally left blank <  >
  393. 150 Opening connection
  394. 226 Transfer complete
  395. 262145 bytes sent in 32.61 seconds (7.8 Kbytes/s)
  396. ftp> quit
  397. 221 Goodbye
  398. newton_46%
  399.  
  400.  
  401.  
  402. Transfer to the Host
  403. A request to send a file from the PC to the host is called a get.
  404.  
  405. get filename.ext
  406.  
  407. Figure 5.2 shows a get operation, using a binary file named 
  408. bridge.pic. Note that the file was in the directory named ibmg, so 
  409. the cd command was used. Again, the boldface type represents user 
  410. entries. If a text file were to be sent after this, the ASCII mode would 
  411. have to be reset, using the FTP ascii command.
  412.  
  413. Figure 5.2     Get from the PC, 
  414. Binary File
  415. newton_41% ftp -n 192.17.20.124
  416. Connected to 192.17.20.124.
  417. 220 PC Resident FTP server, ready
  418. ftp> bin
  419. 200 Type set to I, binary transfer mode
  420. ftp> cd /ibmg
  421. 250 Chdir okay
  422. ftp> get bridge.pic
  423. 200 This space intentionally left blank <  >
  424. 150 Opening connection
  425. 226 Transfer complete
  426. 262144 bytes received in 9.22 seconds (28 Kbytes/s)
  427. ftp>
  428. ftp> quit
  429. 221 Goodbye
  430. newton_42%
  431.  
  432.  
  433.  
  434. FTP Status Indicator
  435. After you have entered a put or get command, in the lower right 
  436. hand corner of your screen you will see the filename and an 
  437. indication of the number of bytes transferred (in the case of a put) 
  438. or left to be transferred (in the case of a get). These numbers are 
  439. updated every couple of seconds to help you keep track of the 
  440. progress of the file transfer. After the command has completed, the 
  441. filename goes away and the host usually prints a confirmation 
  442. message, as seen in Figures 5.1 and 5.2.
  443.  
  444.  
  445. mput, mget
  446. On many telnet hosts, you can transfer multiple files sequentially 
  447. with one command, either mput or mget, used with wildcard 
  448. characters. (PC wildcard characters are ? for a single character 
  449. and * for multiple characters.) For instance, to transfer the 
  450. multiple files, teln.2, and teln.3, you could enter mget (or mput)á*
  451.  
  452.  
  453. Bug with mget
  454. If you transfer multiple binary files using a UNIX host, note that 
  455. there is a bug in mget as implemented on some systems (especially 
  456. 4.2 BSD UNIX). When used in binary mode, mget adds a carriage 
  457. return to the filenames as they are transferred. The files 
  458. themselves are not affected. Use a UNIX utility to remove the 
  459. carriage return from the filename. In ASCII mode, there is no 
  460. problem.
  461.  
  462.  
  463. File Transfer Using rcp
  464.  
  465. rcp is a Berkeley UNIX feature found in Sun UNIX and other 4.2 
  466. BSD systems. The rcp program cannot do the end of line 
  467. translation required for text files, so it is typically used for binary 
  468. files only. UNIX rcp is designed for files copied UNIX-to-UNIX, 
  469. but NCSA Telnet's rcp server supports transfer between a UNIX 
  470. system and a PC.
  471.  
  472. NOTE: NCSA Telnet's rcp server does not support the recursive 
  473. option (-r).
  474.  
  475.  
  476. Setting Up rcp
  477. To use rcp efficiently, you should be familiar with the UNIX host, 
  478. including:
  479.  
  480. Ñ    rcp command and options
  481. Ñ    directory structures used with rcp
  482. Ñ    the relationship between the UNIX shell and rcp wildcards
  483.  
  484. Details on these concepts are in the manuals for UNIX.
  485.  
  486. The internet (IP) number and machine name for each PC must be 
  487. in the UNIX /etc/hosts file for every machine that is 
  488. transferring files to and from your PC. If rcp does not recognize 
  489. your PC's name, have your system administrator check or add that 
  490. name in the UNIX machine's hosts file.
  491.  
  492.  
  493. Using rcp
  494. Use rcp for binary transfers to or from a UNIX system if you are 
  495. familiar with the UNIX hosts, as described earlier.
  496.  
  497. There are two advantages of using rcp rather than FTP, on binary 
  498. file transfers to or from a UNIX machine.
  499.  
  500. Ñ    rcp handles wildcards more efficiently than FTP does.
  501. Ñ    rcp handles directories more easily than FTP does.
  502.  
  503.  
  504. Avoiding Use of NCSA 
  505. Telnet's rcp Server
  506. Do not use the rcp server to transfer text files. Text files on the PC 
  507. contain extra RETURN characters that NCSA Telnet's rcp server 
  508. does not remove when transferring to UNIX.
  509.  
  510. NOTE: Do not initiate an rcp while a file transfer is already in 
  511. process, or both transfers may fail.
  512.  
  513.  
  514. Using rcp Between the PC 
  515. and UNIX
  516. The rcp program is fully documented in the manuals for UNIX 
  517. hosts that support rcp transfers. Refer to those manuals to learn 
  518. about rcp. As a reminder, the general syntax of the rcp command is 
  519. given here. The target filename can be a directory name and 
  520. wildcards are allowed, as noted in the next section.
  521.  
  522. % rcp mypc:filename unixfile        From PC to UNIX
  523. % rcp unixfile mypc:filename        From UNIX to PC
  524.  
  525.  
  526. Example: PC to UNIX
  527. Following is a sample command to transfer a file named image 
  528. from the PC named mypc to the current directory on the UNIX host 
  529. (indicated by a dot or period). Note that the only blank spaces are 
  530. after the command rcp, and between the filename and the target 
  531. directory name (in this case, the dot for the current directory).
  532.  
  533. % rcp mypc:image .
  534.  
  535.  
  536. Example: UNIX to PC
  537. Following is a sample command to transfer a file named mygraf 
  538. in the directory graphs from the UNIX host and put it in the 
  539. directory grafs on the PC.
  540.  
  541. % rcp /graphs/mygraf mypc:/grafs
  542.  
  543.  
  544. Using Wildcards
  545. You can use wildcard characters with the rcp command to transfer 
  546. multiple files between a PC client and a UNIX host. Wildcards that 
  547. refer to UNIX files should be in the UNIX regular expression 
  548. format. You must set wildcards that refer to PC files apart by using 
  549. backslashes or quotes. See the following examples.
  550.  
  551.  
  552. Example: Backslashes Used With Wildcards
  553. One way of using PC wildcards with the rcp server is to use the 
  554. backslash character (\) to keep the UNIX shell from interpreting 
  555. the special characters. Suppose you want to transfer all files that 
  556. have image at the beginning of the filename. Instead of the usual 
  557. PC format, image*.*, you must precede each asterisk with a 
  558. backslash. The full rcp command would look like this:
  559.  
  560. % rcp mypc:image\*.\* .
  561.  
  562. Without the backslashes, the UNIX shell would try to translate the 
  563. asterisk on the host rather than on the PC.
  564.  
  565.  
  566. Example: Quotes Used With Wildcards
  567. The second way of using PC wildcards with the rcp server is to 
  568. insert quotes around the entire argument. The command to 
  569. transfer the files beginning with image would look like this:
  570.  
  571. % rcp "mypc:image*.*" .
  572.  
  573.