home *** CD-ROM | disk | FTP | other *** search
open in:
MacOS 8.1
|
Win98
|
DOS
view JSON data
|
view as text
This file was processed as: LaTeX Document
(document/latex).
You can browse this item here: tex
Confidence | Program | Detection | Match Type | Support
|
---|
100%
| dexvert
| LaTeX Document (document/latex)
| magic
| Supported |
1%
| dexvert
| Text File (text/txt)
| fallback
| Supported |
100%
| file
| LaTeX document text
| default
| |
99%
| file
| LaTeX document, ASCII text
| default
| |
100%
| checkBytes
| Printable ASCII
| default
| |
100%
| perlTextCheck
| Likely Text (Perl)
| default
| |
100%
| siegfried
| fmt/281 LaTeX (Subdocument)
| default
| |
100%
| detectItEasy
| Format: plain text[LF]
| default (weak)
|
|
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 5c 73 65 63 74 69 6f 6e | 7b 53 74 61 6e 64 61 72 |\section|{Standar|
|00000010| 64 20 4d 6f 64 75 6c 65 | 20 5c 73 65 63 74 63 6f |d Module| \sectco|
|00000020| 64 65 7b 66 74 70 6c 69 | 62 7d 7d 0a 5c 73 74 6d |de{ftpli|b}}.\stm|
|00000030| 6f 64 69 6e 64 65 78 7b | 66 74 70 6c 69 62 7d 0a |odindex{|ftplib}.|
|00000040| 0a 5c 72 65 6e 65 77 63 | 6f 6d 6d 61 6e 64 7b 5c |.\renewc|ommand{\|
|00000050| 69 6e 64 65 78 73 75 62 | 69 74 65 6d 7d 7b 28 69 |indexsub|item}{(i|
|00000060| 6e 20 6d 6f 64 75 6c 65 | 20 66 74 70 6c 69 62 29 |n module| ftplib)|
|00000070| 7d 0a 0a 54 68 69 73 20 | 6d 6f 64 75 6c 65 20 64 |}..This |module d|
|00000080| 65 66 69 6e 65 73 20 74 | 68 65 20 63 6c 61 73 73 |efines t|he class|
|00000090| 20 5c 63 6f 64 65 7b 46 | 54 50 7d 20 61 6e 64 20 | \code{F|TP} and |
|000000a0| 61 20 66 65 77 20 72 65 | 6c 61 74 65 64 20 69 74 |a few re|lated it|
|000000b0| 65 6d 73 2e 20 20 54 68 | 65 0a 5c 63 6f 64 65 7b |ems. Th|e.\code{|
|000000c0| 46 54 50 7d 20 63 6c 61 | 73 73 20 69 6d 70 6c 65 |FTP} cla|ss imple|
|000000d0| 6d 65 6e 74 73 20 74 68 | 65 20 63 6c 69 65 6e 74 |ments th|e client|
|000000e0| 20 73 69 64 65 20 6f 66 | 20 74 68 65 20 46 54 50 | side of| the FTP|
|000000f0| 20 70 72 6f 74 6f 63 6f | 6c 2e 20 20 59 6f 75 0a | protoco|l. You.|
|00000100| 63 61 6e 20 75 73 65 20 | 74 68 69 73 20 74 6f 20 |can use |this to |
|00000110| 77 72 69 74 65 20 50 79 | 74 68 6f 6e 20 70 72 6f |write Py|thon pro|
|00000120| 67 72 61 6d 73 20 74 68 | 61 74 20 70 65 72 66 6f |grams th|at perfo|
|00000130| 72 6d 20 61 20 76 61 72 | 69 65 74 79 20 6f 66 0a |rm a var|iety of.|
|00000140| 61 75 74 6f 6d 61 74 65 | 64 20 46 54 50 20 6a 6f |automate|d FTP jo|
|00000150| 62 73 2c 20 73 75 63 68 | 20 61 73 20 6d 69 72 72 |bs, such| as mirr|
|00000160| 6f 72 69 6e 67 20 6f 74 | 68 65 72 20 66 74 70 20 |oring ot|her ftp |
|00000170| 73 65 72 76 65 72 73 2e | 20 20 49 74 20 69 73 20 |servers.| It is |
|00000180| 61 6c 73 6f 0a 75 73 65 | 64 20 62 79 20 74 68 65 |also.use|d by the|
|00000190| 20 6d 6f 64 75 6c 65 20 | 5c 63 6f 64 65 7b 75 72 | module |\code{ur|
|000001a0| 6c 6c 69 62 7d 20 74 6f | 20 68 61 6e 64 6c 65 20 |llib} to| handle |
|000001b0| 55 52 4c 73 20 74 68 61 | 74 20 75 73 65 20 46 54 |URLs tha|t use FT|
|000001c0| 50 2e 20 20 46 6f 72 0a | 6d 6f 72 65 20 69 6e 66 |P. For.|more inf|
|000001d0| 6f 72 6d 61 74 69 6f 6e | 20 6f 6e 20 46 54 50 20 |ormation| on FTP |
|000001e0| 28 46 69 6c 65 20 54 72 | 61 6e 73 66 65 72 20 50 |(File Tr|ansfer P|
|000001f0| 72 6f 74 6f 63 6f 6c 29 | 2c 20 73 65 65 20 49 6e |rotocol)|, see In|
|00000200| 74 65 72 6e 65 74 20 52 | 46 43 0a 39 35 39 2e 0a |ternet R|FC.959..|
|00000210| 0a 48 65 72 65 27 73 20 | 61 20 73 61 6d 70 6c 65 |.Here's |a sample|
|00000220| 20 73 65 73 73 69 6f 6e | 20 75 73 69 6e 67 20 74 | session| using t|
|00000230| 68 65 20 5c 63 6f 64 65 | 7b 66 74 70 6c 69 62 7d |he \code|{ftplib}|
|00000240| 20 6d 6f 64 75 6c 65 3a | 0a 0a 5c 62 65 67 69 6e | module:|..\begin|
|00000250| 7b 76 65 72 62 61 74 69 | 6d 7d 0a 3e 3e 3e 20 66 |{verbati|m}.>>> f|
|00000260| 72 6f 6d 20 66 74 70 6c | 69 62 20 69 6d 70 6f 72 |rom ftpl|ib impor|
|00000270| 74 20 46 54 50 0a 3e 3e | 3e 20 66 74 70 20 3d 20 |t FTP.>>|> ftp = |
|00000280| 46 54 50 28 27 66 74 70 | 2e 63 77 69 2e 6e 6c 27 |FTP('ftp|.cwi.nl'|
|00000290| 29 20 20 20 23 20 63 6f | 6e 6e 65 63 74 20 74 6f |) # co|nnect to|
|000002a0| 20 68 6f 73 74 2c 20 64 | 65 66 61 75 6c 74 20 70 | host, d|efault p|
|000002b0| 6f 72 74 0a 3e 3e 3e 20 | 66 74 70 2e 6c 6f 67 69 |ort.>>> |ftp.logi|
|000002c0| 6e 28 29 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |n() | |
|000002d0| 20 20 23 20 75 73 65 72 | 20 61 6e 6f 6e 79 6d 6f | # user| anonymo|
|000002e0| 75 73 2c 20 70 61 73 73 | 77 64 20 75 73 65 72 40 |us, pass|wd user@|
|000002f0| 68 6f 73 74 6e 61 6d 65 | 0a 3e 3e 3e 20 66 74 70 |hostname|.>>> ftp|
|00000300| 2e 72 65 74 72 6c 69 6e | 65 73 28 27 4c 49 53 54 |.retrlin|es('LIST|
|00000310| 27 29 20 20 20 20 20 23 | 20 6c 69 73 74 20 64 69 |') #| list di|
|00000320| 72 65 63 74 6f 72 79 20 | 63 6f 6e 74 65 6e 74 73 |rectory |contents|
|00000330| 0a 74 6f 74 61 6c 20 32 | 34 34 31 38 0a 64 72 77 |.total 2|4418.drw|
|00000340| 78 72 77 73 72 2d 78 20 | 20 20 35 20 66 74 70 2d |xrwsr-x | 5 ftp-|
|00000350| 75 73 72 20 20 70 64 6d | 61 69 6e 74 20 20 20 20 |usr pdm|aint |
|00000360| 20 31 35 33 36 20 4d 61 | 72 20 32 30 20 30 39 3a | 1536 Ma|r 20 09:|
|00000370| 34 38 20 2e 0a 64 72 2d | 78 72 2d 73 72 77 74 20 |48 ..dr-|xr-srwt |
|00000380| 31 30 35 20 66 74 70 2d | 75 73 72 20 20 70 64 6d |105 ftp-|usr pdm|
|00000390| 61 69 6e 74 20 20 20 20 | 20 31 35 33 36 20 4d 61 |aint | 1536 Ma|
|000003a0| 72 20 32 31 20 31 34 3a | 33 32 20 2e 2e 0a 2d 72 |r 21 14:|32 ...-r|
|000003b0| 77 2d 72 2d 2d 72 2d 2d | 20 20 20 31 20 66 74 70 |w-r--r--| 1 ftp|
|000003c0| 2d 75 73 72 20 20 70 64 | 6d 61 69 6e 74 20 20 20 |-usr pd|maint |
|000003d0| 20 20 35 33 30 35 20 4d | 61 72 20 32 30 20 30 39 | 5305 M|ar 20 09|
|000003e0| 3a 34 38 20 49 4e 44 45 | 58 0a 20 2e 0a 20 2e 0a |:48 INDE|X. .. ..|
|000003f0| 20 2e 0a 3e 3e 3e 20 66 | 74 70 2e 71 75 69 74 28 | ..>>> f|tp.quit(|
|00000400| 29 0a 5c 65 6e 64 7b 76 | 65 72 62 61 74 69 6d 7d |).\end{v|erbatim}|
|00000410| 0a 0a 54 68 65 20 6d 6f | 64 75 6c 65 20 64 65 66 |..The mo|dule def|
|00000420| 69 6e 65 73 20 74 68 65 | 20 66 6f 6c 6c 6f 77 69 |ines the| followi|
|00000430| 6e 67 20 69 74 65 6d 73 | 3a 0a 0a 5c 62 65 67 69 |ng items|:..\begi|
|00000440| 6e 7b 66 75 6e 63 64 65 | 73 63 7d 7b 46 54 50 7d |n{funcde|sc}{FTP}|
|00000450| 7b 5c 6f 70 74 69 6f 6e | 61 6c 7b 68 6f 73 74 5c |{\option|al{host\|
|00000460| 6f 70 74 69 6f 6e 61 6c | 7b 5c 2c 20 75 73 65 72 |optional|{\, user|
|00000470| 5c 2c 20 70 61 73 73 77 | 64 5c 2c 20 61 63 63 74 |\, passw|d\, acct|
|00000480| 7d 7d 7d 0a 52 65 74 75 | 72 6e 20 61 20 6e 65 77 |}}}.Retu|rn a new|
|00000490| 20 69 6e 73 74 61 6e 63 | 65 20 6f 66 20 74 68 65 | instanc|e of the|
|000004a0| 20 5c 63 6f 64 65 7b 46 | 54 50 7d 20 63 6c 61 73 | \code{F|TP} clas|
|000004b0| 73 2e 20 20 57 68 65 6e | 0a 5c 76 61 72 7b 68 6f |s. When|.\var{ho|
|000004c0| 73 74 7d 20 69 73 20 67 | 69 76 65 6e 2c 20 74 68 |st} is g|iven, th|
|000004d0| 65 20 6d 65 74 68 6f 64 | 20 63 61 6c 6c 20 5c 63 |e method| call \c|
|000004e0| 6f 64 65 7b 63 6f 6e 6e | 65 63 74 28 5c 76 61 72 |ode{conn|ect(\var|
|000004f0| 7b 68 6f 73 74 7d 29 7d | 20 69 73 0a 6d 61 64 65 |{host})}| is.made|
|00000500| 2e 20 20 57 68 65 6e 20 | 5c 76 61 72 7b 75 73 65 |. When |\var{use|
|00000510| 72 7d 20 69 73 20 67 69 | 76 65 6e 2c 20 61 64 64 |r} is gi|ven, add|
|00000520| 69 74 69 6f 6e 61 6c 6c | 79 20 74 68 65 20 6d 65 |itionall|y the me|
|00000530| 74 68 6f 64 20 63 61 6c | 6c 0a 5c 63 6f 64 65 7b |thod cal|l.\code{|
|00000540| 6c 6f 67 69 6e 28 5c 76 | 61 72 7b 75 73 65 72 7d |login(\v|ar{user}|
|00000550| 2c 20 5c 76 61 72 7b 70 | 61 73 73 77 64 7d 2c 20 |, \var{p|asswd}, |
|00000560| 5c 76 61 72 7b 61 63 63 | 74 7d 29 7d 20 69 73 20 |\var{acc|t})} is |
|00000570| 6d 61 64 65 20 28 77 68 | 65 72 65 0a 5c 76 61 72 |made (wh|ere.\var|
|00000580| 7b 70 61 73 73 77 64 7d | 20 61 6e 64 20 5c 76 61 |{passwd}| and \va|
|00000590| 72 7b 61 63 63 74 7d 20 | 64 65 66 61 75 6c 74 20 |r{acct} |default |
|000005a0| 74 6f 20 74 68 65 20 65 | 6d 70 74 79 20 73 74 72 |to the e|mpty str|
|000005b0| 69 6e 67 20 77 68 65 6e | 20 6e 6f 74 20 67 69 76 |ing when| not giv|
|000005c0| 65 6e 29 2e 0a 5c 65 6e | 64 7b 66 75 6e 63 64 65 |en)..\en|d{funcde|
|000005d0| 73 63 7d 0a 0a 5c 62 65 | 67 69 6e 7b 64 61 74 61 |sc}..\be|gin{data|
|000005e0| 64 65 73 63 7d 7b 61 6c | 6c 5f 65 72 72 6f 72 73 |desc}{al|l_errors|
|000005f0| 7d 0a 54 68 65 20 73 65 | 74 20 6f 66 20 61 6c 6c |}.The se|t of all|
|00000600| 20 65 78 63 65 70 74 69 | 6f 6e 73 20 28 61 73 20 | excepti|ons (as |
|00000610| 61 20 74 75 70 6c 65 29 | 20 74 68 61 74 20 6d 65 |a tuple)| that me|
|00000620| 74 68 6f 64 73 20 6f 66 | 20 5c 63 6f 64 65 7b 46 |thods of| \code{F|
|00000630| 54 50 7d 0a 69 6e 73 74 | 61 6e 63 65 73 20 6d 61 |TP}.inst|ances ma|
|00000640| 79 20 72 61 69 73 65 20 | 61 73 20 61 20 72 65 73 |y raise |as a res|
|00000650| 75 6c 74 20 6f 66 20 70 | 72 6f 62 6c 65 6d 73 20 |ult of p|roblems |
|00000660| 77 69 74 68 20 74 68 65 | 20 46 54 50 20 63 6f 6e |with the| FTP con|
|00000670| 6e 65 63 74 69 6f 6e 0a | 28 61 73 20 6f 70 70 6f |nection.|(as oppo|
|00000680| 73 65 64 20 74 6f 20 70 | 72 6f 67 72 61 6d 6d 69 |sed to p|rogrammi|
|00000690| 6e 67 20 65 72 72 6f 72 | 73 20 6d 61 64 65 20 62 |ng error|s made b|
|000006a0| 79 20 74 68 65 20 63 61 | 6c 6c 65 72 29 2e 20 20 |y the ca|ller). |
|000006b0| 54 68 69 73 20 73 65 74 | 0a 69 6e 63 6c 75 64 65 |This set|.include|
|000006c0| 73 20 74 68 65 20 66 6f | 75 72 20 65 78 63 65 70 |s the fo|ur excep|
|000006d0| 74 69 6f 6e 73 20 6c 69 | 73 74 65 64 20 62 65 6c |tions li|sted bel|
|000006e0| 6f 77 20 61 73 20 77 65 | 6c 6c 20 61 73 0a 5c 63 |ow as we|ll as.\c|
|000006f0| 6f 64 65 7b 73 6f 63 6b | 65 74 2e 65 72 72 6f 72 |ode{sock|et.error|
|00000700| 7d 20 61 6e 64 20 5c 63 | 6f 64 65 7b 49 4f 45 72 |} and \c|ode{IOEr|
|00000710| 72 6f 72 7d 2e 0a 5c 65 | 6e 64 7b 64 61 74 61 64 |ror}..\e|nd{datad|
|00000720| 65 73 63 7d 0a 0a 5c 62 | 65 67 69 6e 7b 65 78 63 |esc}..\b|egin{exc|
|00000730| 64 65 73 63 7d 7b 65 72 | 72 6f 72 5f 72 65 70 6c |desc}{er|ror_repl|
|00000740| 79 7d 0a 45 78 63 65 70 | 74 69 6f 6e 20 72 61 69 |y}.Excep|tion rai|
|00000750| 73 65 64 20 77 68 65 6e | 20 61 6e 20 75 6e 65 78 |sed when| an unex|
|00000760| 70 65 63 74 65 64 20 72 | 65 70 6c 79 20 69 73 20 |pected r|eply is |
|00000770| 72 65 63 65 69 76 65 64 | 20 66 72 6f 6d 20 74 68 |received| from th|
|00000780| 65 20 73 65 72 76 65 72 | 2e 0a 5c 65 6e 64 7b 65 |e server|..\end{e|
|00000790| 78 63 64 65 73 63 7d 0a | 0a 5c 62 65 67 69 6e 7b |xcdesc}.|.\begin{|
|000007a0| 65 78 63 64 65 73 63 7d | 7b 65 72 72 6f 72 5f 74 |excdesc}|{error_t|
|000007b0| 65 6d 70 7d 0a 45 78 63 | 65 70 74 69 6f 6e 20 72 |emp}.Exc|eption r|
|000007c0| 61 69 73 65 64 20 77 68 | 65 6e 20 61 6e 20 65 72 |aised wh|en an er|
|000007d0| 72 6f 72 20 63 6f 64 65 | 20 69 6e 20 74 68 65 20 |ror code| in the |
|000007e0| 72 61 6e 67 65 20 34 30 | 30 2d 2d 34 39 39 20 69 |range 40|0--499 i|
|000007f0| 73 20 72 65 63 65 69 76 | 65 64 2e 0a 5c 65 6e 64 |s receiv|ed..\end|
|00000800| 7b 65 78 63 64 65 73 63 | 7d 0a 0a 5c 62 65 67 69 |{excdesc|}..\begi|
|00000810| 6e 7b 65 78 63 64 65 73 | 63 7d 7b 65 72 72 6f 72 |n{excdes|c}{error|
|00000820| 5f 70 65 72 6d 7d 0a 45 | 78 63 65 70 74 69 6f 6e |_perm}.E|xception|
|00000830| 20 72 61 69 73 65 64 20 | 77 68 65 6e 20 61 6e 20 | raised |when an |
|00000840| 65 72 72 6f 72 20 63 6f | 64 65 20 69 6e 20 74 68 |error co|de in th|
|00000850| 65 20 72 61 6e 67 65 20 | 35 30 30 2d 2d 35 39 39 |e range |500--599|
|00000860| 20 69 73 20 72 65 63 65 | 69 76 65 64 2e 0a 5c 65 | is rece|ived..\e|
|00000870| 6e 64 7b 65 78 63 64 65 | 73 63 7d 0a 0a 5c 62 65 |nd{excde|sc}..\be|
|00000880| 67 69 6e 7b 65 78 63 64 | 65 73 63 7d 7b 65 72 72 |gin{excd|esc}{err|
|00000890| 6f 72 5f 70 72 6f 74 6f | 7d 0a 45 78 63 65 70 74 |or_proto|}.Except|
|000008a0| 69 6f 6e 20 72 61 69 73 | 65 64 20 77 68 65 6e 20 |ion rais|ed when |
|000008b0| 61 20 72 65 70 6c 79 20 | 69 73 20 72 65 63 65 69 |a reply |is recei|
|000008c0| 76 65 64 20 66 72 6f 6d | 20 74 68 65 20 73 65 72 |ved from| the ser|
|000008d0| 76 65 72 20 74 68 61 74 | 20 64 6f 65 73 0a 6e 6f |ver that| does.no|
|000008e0| 74 20 62 65 67 69 6e 20 | 77 69 74 68 20 61 20 64 |t begin |with a d|
|000008f0| 69 67 69 74 20 69 6e 20 | 74 68 65 20 72 61 6e 67 |igit in |the rang|
|00000900| 65 20 31 2d 2d 35 2e 0a | 5c 65 6e 64 7b 65 78 63 |e 1--5..|\end{exc|
|00000910| 64 65 73 63 7d 0a 0a 5c | 73 75 62 73 65 63 74 69 |desc}..\|subsecti|
|00000920| 6f 6e 7b 46 54 50 20 4f | 62 6a 65 63 74 73 7d 0a |on{FTP O|bjects}.|
|00000930| 0a 46 54 50 20 69 6e 73 | 74 61 6e 63 65 73 20 68 |.FTP ins|tances h|
|00000940| 61 76 65 20 74 68 65 20 | 66 6f 6c 6c 6f 77 69 6e |ave the |followin|
|00000950| 67 20 6d 65 74 68 6f 64 | 73 3a 0a 0a 5c 72 65 6e |g method|s:..\ren|
|00000960| 65 77 63 6f 6d 6d 61 6e | 64 7b 5c 69 6e 64 65 78 |ewcomman|d{\index|
|00000970| 73 75 62 69 74 65 6d 7d | 7b 28 46 54 50 20 6f 62 |subitem}|{(FTP ob|
|00000980| 6a 65 63 74 20 6d 65 74 | 68 6f 64 29 7d 0a 0a 5c |ject met|hod)}..\|
|00000990| 62 65 67 69 6e 7b 66 75 | 6e 63 64 65 73 63 7d 7b |begin{fu|ncdesc}{|
|000009a0| 73 65 74 5f 64 65 62 75 | 67 6c 65 76 65 6c 7d 7b |set_debu|glevel}{|
|000009b0| 6c 65 76 65 6c 7d 0a 53 | 65 74 20 74 68 65 20 69 |level}.S|et the i|
|000009c0| 6e 73 74 61 6e 63 65 27 | 73 20 64 65 62 75 67 67 |nstance'|s debugg|
|000009d0| 69 6e 67 20 6c 65 76 65 | 6c 2e 20 20 54 68 69 73 |ing leve|l. This|
|000009e0| 20 63 6f 6e 74 72 6f 6c | 73 20 74 68 65 20 61 6d | control|s the am|
|000009f0| 6f 75 6e 74 20 6f 66 0a | 64 65 62 75 67 67 69 6e |ount of.|debuggin|
|00000a00| 67 20 6f 75 74 70 75 74 | 20 70 72 69 6e 74 65 64 |g output| printed|
|00000a10| 2e 20 20 54 68 65 20 64 | 65 66 61 75 6c 74 2c 20 |. The d|efault, |
|00000a20| 30 2c 20 70 72 6f 64 75 | 63 65 73 20 6e 6f 20 64 |0, produ|ces no d|
|00000a30| 65 62 75 67 67 69 6e 67 | 0a 6f 75 74 70 75 74 2e |ebugging|.output.|
|00000a40| 20 20 41 20 76 61 6c 75 | 65 20 6f 66 20 31 20 70 | A valu|e of 1 p|
|00000a50| 72 6f 64 75 63 65 73 20 | 61 20 6d 6f 64 65 72 61 |roduces |a modera|
|00000a60| 74 65 20 61 6d 6f 75 6e | 74 20 6f 66 20 64 65 62 |te amoun|t of deb|
|00000a70| 75 67 67 69 6e 67 20 6f | 75 74 70 75 74 2c 0a 67 |ugging o|utput,.g|
|00000a80| 65 6e 65 72 61 6c 6c 79 | 20 61 20 73 69 6e 67 6c |enerally| a singl|
|00000a90| 65 20 6c 69 6e 65 20 70 | 65 72 20 72 65 71 75 65 |e line p|er reque|
|00000aa0| 73 74 2e 20 20 41 20 76 | 61 6c 75 65 20 6f 66 20 |st. A v|alue of |
|00000ab0| 32 20 6f 72 20 68 69 67 | 68 65 72 20 70 72 6f 64 |2 or hig|her prod|
|00000ac0| 75 63 65 73 0a 74 68 65 | 20 6d 61 78 69 6d 75 6d |uces.the| maximum|
|00000ad0| 20 61 6d 6f 75 6e 74 20 | 6f 66 20 64 65 62 75 67 | amount |of debug|
|00000ae0| 67 69 6e 67 20 6f 75 74 | 70 75 74 2c 20 6c 6f 67 |ging out|put, log|
|00000af0| 67 69 6e 67 20 65 61 63 | 68 20 6c 69 6e 65 20 73 |ging eac|h line s|
|00000b00| 65 6e 74 20 61 6e 64 0a | 72 65 63 65 69 76 65 64 |ent and.|received|
|00000b10| 20 6f 6e 20 74 68 65 20 | 63 6f 6e 74 72 6f 6c 20 | on the |control |
|00000b20| 63 6f 6e 6e 65 63 74 69 | 6f 6e 2e 0a 5c 65 6e 64 |connecti|on..\end|
|00000b30| 7b 66 75 6e 63 64 65 73 | 63 7d 0a 0a 5c 62 65 67 |{funcdes|c}..\beg|
|00000b40| 69 6e 7b 66 75 6e 63 64 | 65 73 63 7d 7b 63 6f 6e |in{funcd|esc}{con|
|00000b50| 6e 65 63 74 7d 7b 68 6f | 73 74 5c 6f 70 74 69 6f |nect}{ho|st\optio|
|00000b60| 6e 61 6c 7b 5c 2c 20 70 | 6f 72 74 7d 7d 0a 43 6f |nal{\, p|ort}}.Co|
|00000b70| 6e 6e 65 63 74 20 74 6f | 20 74 68 65 20 67 69 76 |nnect to| the giv|
|00000b80| 65 6e 20 68 6f 73 74 20 | 61 6e 64 20 70 6f 72 74 |en host |and port|
|00000b90| 2e 20 20 54 68 65 20 64 | 65 66 61 75 6c 74 20 70 |. The d|efault p|
|00000ba0| 6f 72 74 20 6e 75 6d 62 | 65 72 20 69 73 20 32 31 |ort numb|er is 21|
|00000bb0| 2c 20 61 73 0a 73 70 65 | 63 69 66 69 65 64 20 62 |, as.spe|cified b|
|00000bc0| 79 20 74 68 65 20 46 54 | 50 20 70 72 6f 74 6f 63 |y the FT|P protoc|
|00000bd0| 6f 6c 20 73 70 65 63 69 | 66 69 63 61 74 69 6f 6e |ol speci|fication|
|00000be0| 2e 20 20 49 74 20 69 73 | 20 72 61 72 65 6c 79 20 |. It is| rarely |
|00000bf0| 6e 65 65 64 65 64 20 74 | 6f 0a 73 70 65 63 69 66 |needed t|o.specif|
|00000c00| 79 20 61 20 64 69 66 66 | 65 72 65 6e 74 20 70 6f |y a diff|erent po|
|00000c10| 72 74 20 6e 75 6d 62 65 | 72 2e 20 20 54 68 69 73 |rt numbe|r. This|
|00000c20| 20 66 75 6e 63 74 69 6f | 6e 20 73 68 6f 75 6c 64 | functio|n should|
|00000c30| 20 62 65 20 63 61 6c 6c | 65 64 20 6f 6e 6c 79 0a | be call|ed only.|
|00000c40| 6f 6e 63 65 20 66 6f 72 | 20 65 61 63 68 20 69 6e |once for| each in|
|00000c50| 73 74 61 6e 63 65 3b 20 | 69 74 20 73 68 6f 75 6c |stance; |it shoul|
|00000c60| 64 20 6e 6f 74 20 62 65 | 20 63 61 6c 6c 65 64 20 |d not be| called |
|00000c70| 61 74 20 61 6c 6c 20 69 | 66 20 61 20 68 6f 73 74 |at all i|f a host|
|00000c80| 20 77 61 73 0a 67 69 76 | 65 6e 20 77 68 65 6e 20 | was.giv|en when |
|00000c90| 74 68 65 20 69 6e 73 74 | 61 6e 63 65 20 77 61 73 |the inst|ance was|
|00000ca0| 20 63 72 65 61 74 65 64 | 2e 20 20 41 6c 6c 20 6f | created|. All o|
|00000cb0| 74 68 65 72 20 6d 65 74 | 68 6f 64 73 20 63 61 6e |ther met|hods can|
|00000cc0| 20 6f 6e 6c 79 20 62 65 | 0a 75 73 65 64 20 61 66 | only be|.used af|
|00000cd0| 74 65 72 20 61 20 63 6f | 6e 6e 65 63 74 69 6f 6e |ter a co|nnection|
|00000ce0| 20 68 61 73 20 62 65 65 | 6e 20 6d 61 64 65 2e 0a | has bee|n made..|
|00000cf0| 5c 65 6e 64 7b 66 75 6e | 63 64 65 73 63 7d 0a 0a |\end{fun|cdesc}..|
|00000d00| 5c 62 65 67 69 6e 7b 66 | 75 6e 63 64 65 73 63 7d |\begin{f|uncdesc}|
|00000d10| 7b 67 65 74 77 65 6c 63 | 6f 6d 65 7d 7b 7d 0a 52 |{getwelc|ome}{}.R|
|00000d20| 65 74 75 72 6e 20 74 68 | 65 20 77 65 6c 63 6f 6d |eturn th|e welcom|
|00000d30| 65 20 6d 65 73 73 61 67 | 65 20 73 65 6e 74 20 62 |e messag|e sent b|
|00000d40| 79 20 74 68 65 20 73 65 | 72 76 65 72 20 69 6e 20 |y the se|rver in |
|00000d50| 72 65 70 6c 79 20 74 6f | 20 74 68 65 20 69 6e 69 |reply to| the ini|
|00000d60| 74 69 61 6c 0a 63 6f 6e | 6e 65 63 74 69 6f 6e 2e |tial.con|nection.|
|00000d70| 20 20 28 54 68 69 73 20 | 6d 65 73 73 61 67 65 20 | (This |message |
|00000d80| 73 6f 6d 65 74 69 6d 65 | 73 20 63 6f 6e 74 61 69 |sometime|s contai|
|00000d90| 6e 73 20 64 69 73 63 6c | 61 69 6d 65 72 73 20 6f |ns discl|aimers o|
|00000da0| 72 20 68 65 6c 70 0a 69 | 6e 66 6f 72 6d 61 74 69 |r help.i|nformati|
|00000db0| 6f 6e 20 74 68 61 74 20 | 6d 61 79 20 62 65 20 72 |on that |may be r|
|00000dc0| 65 6c 65 76 61 6e 74 20 | 74 6f 20 74 68 65 20 75 |elevant |to the u|
|00000dd0| 73 65 72 2e 29 0a 5c 65 | 6e 64 7b 66 75 6e 63 64 |ser.).\e|nd{funcd|
|00000de0| 65 73 63 7d 0a 0a 5c 62 | 65 67 69 6e 7b 66 75 6e |esc}..\b|egin{fun|
|00000df0| 63 64 65 73 63 7d 7b 6c | 6f 67 69 6e 7d 7b 5c 6f |cdesc}{l|ogin}{\o|
|00000e00| 70 74 69 6f 6e 61 6c 7b | 75 73 65 72 5c 6f 70 74 |ptional{|user\opt|
|00000e10| 69 6f 6e 61 6c 7b 5c 2c | 20 70 61 73 73 77 64 5c |ional{\,| passwd\|
|00000e20| 6f 70 74 69 6f 6e 61 6c | 7b 5c 2c 20 61 63 63 74 |optional|{\, acct|
|00000e30| 7d 7d 7d 7d 0a 4c 6f 67 | 20 69 6e 20 61 73 20 74 |}}}}.Log| in as t|
|00000e40| 68 65 20 67 69 76 65 6e | 20 5c 76 61 72 7b 75 73 |he given| \var{us|
|00000e50| 65 72 7d 2e 20 20 54 68 | 65 20 5c 76 61 72 7b 70 |er}. Th|e \var{p|
|00000e60| 61 73 73 77 64 7d 20 61 | 6e 64 20 5c 76 61 72 7b |asswd} a|nd \var{|
|00000e70| 61 63 63 74 7d 0a 70 61 | 72 61 6d 65 74 65 72 73 |acct}.pa|rameters|
|00000e80| 20 61 72 65 20 6f 70 74 | 69 6f 6e 61 6c 20 61 6e | are opt|ional an|
|00000e90| 64 20 64 65 66 61 75 6c | 74 20 74 6f 20 74 68 65 |d defaul|t to the|
|00000ea0| 20 65 6d 70 74 79 20 73 | 74 72 69 6e 67 2e 20 20 | empty s|tring. |
|00000eb0| 49 66 20 6e 6f 0a 5c 76 | 61 72 7b 75 73 65 72 7d |If no.\v|ar{user}|
|00000ec0| 20 69 73 20 73 70 65 63 | 69 66 69 65 64 2c 20 69 | is spec|ified, i|
|00000ed0| 74 20 64 65 66 61 75 6c | 74 73 20 74 6f 20 5c 73 |t defaul|ts to \s|
|00000ee0| 61 6d 70 7b 61 6e 6f 6e | 79 6d 6f 75 73 7d 2e 20 |amp{anon|ymous}. |
|00000ef0| 20 49 66 0a 5c 76 61 72 | 7b 75 73 65 72 7d 20 69 | If.\var|{user} i|
|00000f00| 73 20 5c 63 6f 64 65 7b | 61 6e 6f 6e 79 6d 6f 75 |s \code{|anonymou|
|00000f10| 73 7d 2c 20 74 68 65 20 | 64 65 66 61 75 6c 74 20 |s}, the |default |
|00000f20| 5c 76 61 72 7b 70 61 73 | 73 77 64 7d 20 69 73 0a |\var{pas|swd} is.|
|00000f30| 5c 73 61 6d 70 7b 5c 76 | 61 72 7b 72 65 61 6c 75 |\samp{\v|ar{realu|
|00000f40| 73 65 72 7d 40 5c 76 61 | 72 7b 68 6f 73 74 7d 7d |ser}@\va|r{host}}|
|00000f50| 20 77 68 65 72 65 20 5c | 76 61 72 7b 72 65 61 6c | where \|var{real|
|00000f60| 75 73 65 72 7d 20 69 73 | 20 74 68 65 20 72 65 61 |user} is| the rea|
|00000f70| 6c 20 75 73 65 72 0a 6e | 61 6d 65 20 28 67 6c 61 |l user.n|ame (gla|
|00000f80| 6e 63 65 64 20 66 72 6f | 6d 20 74 68 65 20 5c 73 |nced fro|m the \s|
|00000f90| 61 6d 70 7b 4c 4f 47 4e | 41 4d 45 7d 20 6f 72 20 |amp{LOGN|AME} or |
|00000fa0| 5c 73 61 6d 70 7b 55 53 | 45 52 7d 20 65 6e 76 69 |\samp{US|ER} envi|
|00000fb0| 72 6f 6e 6d 65 6e 74 0a | 76 61 72 69 61 62 6c 65 |ronment.|variable|
|00000fc0| 29 20 61 6e 64 20 5c 76 | 61 72 7b 68 6f 73 74 7d |) and \v|ar{host}|
|00000fd0| 20 69 73 20 74 68 65 20 | 68 6f 73 74 6e 61 6d 65 | is the |hostname|
|00000fe0| 20 61 73 20 72 65 74 75 | 72 6e 65 64 20 62 79 0a | as retu|rned by.|
|00000ff0| 5c 63 6f 64 65 7b 73 6f | 63 6b 65 74 2e 67 65 74 |\code{so|cket.get|
|00001000| 68 6f 73 74 6e 61 6d 65 | 28 29 7d 2e 20 20 54 68 |hostname|()}. Th|
|00001010| 69 73 20 66 75 6e 63 74 | 69 6f 6e 20 73 68 6f 75 |is funct|ion shou|
|00001020| 6c 64 20 62 65 20 63 61 | 6c 6c 65 64 20 6f 6e 6c |ld be ca|lled onl|
|00001030| 79 0a 6f 6e 63 65 20 66 | 6f 72 20 65 61 63 68 20 |y.once f|or each |
|00001040| 69 6e 73 74 61 6e 63 65 | 2c 20 61 66 74 65 72 20 |instance|, after |
|00001050| 61 20 63 6f 6e 6e 65 63 | 74 69 6f 6e 20 68 61 73 |a connec|tion has|
|00001060| 20 62 65 65 6e 20 65 73 | 74 61 62 6c 69 73 68 65 | been es|tablishe|
|00001070| 64 3b 20 69 74 0a 73 68 | 6f 75 6c 64 20 6e 6f 74 |d; it.sh|ould not|
|00001080| 20 62 65 20 63 61 6c 6c | 65 64 20 61 74 20 61 6c | be call|ed at al|
|00001090| 6c 20 69 66 20 61 20 68 | 6f 73 74 20 61 6e 64 20 |l if a h|ost and |
|000010a0| 75 73 65 72 20 77 65 72 | 65 20 67 69 76 65 6e 20 |user wer|e given |
|000010b0| 77 68 65 6e 20 74 68 65 | 0a 69 6e 73 74 61 6e 63 |when the|.instanc|
|000010c0| 65 20 77 61 73 20 63 72 | 65 61 74 65 64 2e 20 20 |e was cr|eated. |
|000010d0| 4d 6f 73 74 20 46 54 50 | 20 63 6f 6d 6d 61 6e 64 |Most FTP| command|
|000010e0| 73 20 61 72 65 20 6f 6e | 6c 79 20 61 6c 6c 6f 77 |s are on|ly allow|
|000010f0| 65 64 20 61 66 74 65 72 | 20 74 68 65 0a 63 6c 69 |ed after| the.cli|
|00001100| 65 6e 74 20 68 61 73 20 | 6c 6f 67 67 65 64 20 69 |ent has |logged i|
|00001110| 6e 2e 0a 5c 65 6e 64 7b | 66 75 6e 63 64 65 73 63 |n..\end{|funcdesc|
|00001120| 7d 0a 0a 5c 62 65 67 69 | 6e 7b 66 75 6e 63 64 65 |}..\begi|n{funcde|
|00001130| 73 63 7d 7b 61 62 6f 72 | 74 7d 7b 7d 0a 41 62 6f |sc}{abor|t}{}.Abo|
|00001140| 72 74 20 61 20 66 69 6c | 65 20 74 72 61 6e 73 66 |rt a fil|e transf|
|00001150| 65 72 20 74 68 61 74 20 | 69 73 20 69 6e 20 70 72 |er that |is in pr|
|00001160| 6f 67 72 65 73 73 2e 20 | 20 55 73 69 6e 67 20 74 |ogress. | Using t|
|00001170| 68 69 73 20 64 6f 65 73 | 20 6e 6f 74 20 61 6c 77 |his does| not alw|
|00001180| 61 79 73 0a 77 6f 72 6b | 2c 20 62 75 74 20 69 74 |ays.work|, but it|
|00001190| 27 73 20 77 6f 72 74 68 | 20 61 20 74 72 79 2e 0a |'s worth| a try..|
|000011a0| 5c 65 6e 64 7b 66 75 6e | 63 64 65 73 63 7d 0a 0a |\end{fun|cdesc}..|
|000011b0| 5c 62 65 67 69 6e 7b 66 | 75 6e 63 64 65 73 63 7d |\begin{f|uncdesc}|
|000011c0| 7b 73 65 6e 64 63 6d 64 | 7d 7b 63 6f 6d 6d 61 6e |{sendcmd|}{comman|
|000011d0| 64 7d 0a 53 65 6e 64 20 | 61 20 73 69 6d 70 6c 65 |d}.Send |a simple|
|000011e0| 20 63 6f 6d 6d 61 6e 64 | 20 73 74 72 69 6e 67 20 | command| string |
|000011f0| 74 6f 20 74 68 65 20 73 | 65 72 76 65 72 20 61 6e |to the s|erver an|
|00001200| 64 20 72 65 74 75 72 6e | 20 74 68 65 20 72 65 73 |d return| the res|
|00001210| 70 6f 6e 73 65 0a 73 74 | 72 69 6e 67 2e 0a 5c 65 |ponse.st|ring..\e|
|00001220| 6e 64 7b 66 75 6e 63 64 | 65 73 63 7d 0a 0a 5c 62 |nd{funcd|esc}..\b|
|00001230| 65 67 69 6e 7b 66 75 6e | 63 64 65 73 63 7d 7b 76 |egin{fun|cdesc}{v|
|00001240| 6f 69 64 63 6d 64 7d 7b | 63 6f 6d 6d 61 6e 64 7d |oidcmd}{|command}|
|00001250| 0a 53 65 6e 64 20 61 20 | 73 69 6d 70 6c 65 20 63 |.Send a |simple c|
|00001260| 6f 6d 6d 61 6e 64 20 73 | 74 72 69 6e 67 20 74 6f |ommand s|tring to|
|00001270| 20 74 68 65 20 73 65 72 | 76 65 72 20 61 6e 64 20 | the ser|ver and |
|00001280| 68 61 6e 64 6c 65 20 74 | 68 65 20 72 65 73 70 6f |handle t|he respo|
|00001290| 6e 73 65 2e 0a 52 65 74 | 75 72 6e 20 6e 6f 74 68 |nse..Ret|urn noth|
|000012a0| 69 6e 67 20 69 66 20 61 | 20 72 65 73 70 6f 6e 73 |ing if a| respons|
|000012b0| 65 20 63 6f 64 65 20 69 | 6e 20 74 68 65 20 72 61 |e code i|n the ra|
|000012c0| 6e 67 65 20 32 30 30 2d | 2d 32 39 39 20 69 73 20 |nge 200-|-299 is |
|000012d0| 72 65 63 65 69 76 65 64 | 2e 0a 52 61 69 73 65 20 |received|..Raise |
|000012e0| 61 6e 20 65 78 63 65 70 | 74 69 6f 6e 20 6f 74 68 |an excep|tion oth|
|000012f0| 65 72 77 69 73 65 2e 0a | 5c 65 6e 64 7b 66 75 6e |erwise..|\end{fun|
|00001300| 63 64 65 73 63 7d 0a 0a | 5c 62 65 67 69 6e 7b 66 |cdesc}..|\begin{f|
|00001310| 75 6e 63 64 65 73 63 7d | 7b 72 65 74 72 62 69 6e |uncdesc}|{retrbin|
|00001320| 61 72 79 7d 7b 63 6f 6d | 6d 61 6e 64 5c 2c 20 63 |ary}{com|mand\, c|
|00001330| 61 6c 6c 62 61 63 6b 5c | 2c 20 6d 61 78 62 6c 6f |allback\|, maxblo|
|00001340| 63 6b 73 69 7a 65 7d 0a | 52 65 74 72 69 65 76 65 |cksize}.|Retrieve|
|00001350| 20 61 20 66 69 6c 65 20 | 69 6e 20 62 69 6e 61 72 | a file |in binar|
|00001360| 79 20 74 72 61 6e 73 66 | 65 72 20 6d 6f 64 65 2e |y transf|er mode.|
|00001370| 20 20 5c 76 61 72 7b 63 | 6f 6d 6d 61 6e 64 7d 20 | \var{c|ommand} |
|00001380| 73 68 6f 75 6c 64 20 62 | 65 20 61 6e 0a 61 70 70 |should b|e an.app|
|00001390| 72 6f 70 72 69 61 74 65 | 20 5c 73 61 6d 70 7b 52 |ropriate| \samp{R|
|000013a0| 45 54 52 7d 20 63 6f 6d | 6d 61 6e 64 2c 20 69 2e |ETR} com|mand, i.|
|000013b0| 65 2e 5c 20 5c 63 6f 64 | 65 7b 22 52 45 54 52 20 |e.\ \cod|e{"RETR |
|000013c0| 5c 76 61 72 7b 66 69 6c | 65 6e 61 6d 65 7d 22 7d |\var{fil|ename}"}|
|000013d0| 2e 0a 54 68 65 20 5c 76 | 61 72 7b 63 61 6c 6c 62 |..The \v|ar{callb|
|000013e0| 61 63 6b 7d 20 66 75 6e | 63 74 69 6f 6e 20 69 73 |ack} fun|ction is|
|000013f0| 20 63 61 6c 6c 65 64 20 | 66 6f 72 20 65 61 63 68 | called |for each|
|00001400| 20 62 6c 6f 63 6b 20 6f | 66 20 64 61 74 61 20 72 | block o|f data r|
|00001410| 65 63 65 69 76 65 64 2c | 0a 77 69 74 68 20 61 20 |eceived,|.with a |
|00001420| 73 69 6e 67 6c 65 20 73 | 74 72 69 6e 67 20 61 72 |single s|tring ar|
|00001430| 67 75 6d 65 6e 74 20 67 | 69 76 69 6e 67 20 74 68 |gument g|iving th|
|00001440| 65 20 64 61 74 61 20 62 | 6c 6f 63 6b 2e 0a 54 68 |e data b|lock..Th|
|00001450| 65 20 5c 76 61 72 7b 6d | 61 78 62 6c 6f 63 6b 73 |e \var{m|axblocks|
|00001460| 69 7a 65 7d 20 61 72 67 | 75 6d 65 6e 74 20 73 70 |ize} arg|ument sp|
|00001470| 65 63 69 66 69 65 73 20 | 74 68 65 20 6d 61 78 69 |ecifies |the maxi|
|00001480| 6d 75 6d 20 62 6c 6f 63 | 6b 20 73 69 7a 65 0a 28 |mum bloc|k size.(|
|00001490| 77 68 69 63 68 20 6d 61 | 79 20 6e 6f 74 20 62 65 |which ma|y not be|
|000014a0| 20 74 68 65 20 61 63 74 | 75 61 6c 20 73 69 7a 65 | the act|ual size|
|000014b0| 20 6f 66 20 74 68 65 20 | 64 61 74 61 20 62 6c 6f | of the |data blo|
|000014c0| 63 6b 73 20 70 61 73 73 | 65 64 20 74 6f 0a 5c 76 |cks pass|ed to.\v|
|000014d0| 61 72 7b 63 61 6c 6c 62 | 61 63 6b 7d 29 2e 0a 5c |ar{callb|ack})..\|
|000014e0| 65 6e 64 7b 66 75 6e 63 | 64 65 73 63 7d 0a 0a 5c |end{func|desc}..\|
|000014f0| 62 65 67 69 6e 7b 66 75 | 6e 63 64 65 73 63 7d 7b |begin{fu|ncdesc}{|
|00001500| 72 65 74 72 6c 69 6e 65 | 73 7d 7b 63 6f 6d 6d 61 |retrline|s}{comma|
|00001510| 6e 64 5c 6f 70 74 69 6f | 6e 61 6c 7b 5c 2c 20 63 |nd\optio|nal{\, c|
|00001520| 61 6c 6c 62 61 63 6b 7d | 7d 0a 52 65 74 72 69 65 |allback}|}.Retrie|
|00001530| 76 65 20 61 20 66 69 6c | 65 20 6f 72 20 64 69 72 |ve a fil|e or dir|
|00001540| 65 63 74 6f 72 79 20 6c | 69 73 74 69 6e 67 20 69 |ectory l|isting i|
|00001550| 6e 20 5c 41 53 43 49 49 | 7b 7d 20 74 72 61 6e 73 |n \ASCII|{} trans|
|00001560| 66 65 72 20 6d 6f 64 65 | 2e 0a 76 61 72 7b 63 6f |fer mode|..var{co|
|00001570| 6d 6d 61 6e 64 7d 20 73 | 68 6f 75 6c 64 20 62 65 |mmand} s|hould be|
|00001580| 20 61 6e 20 61 70 70 72 | 6f 70 72 69 61 74 65 20 | an appr|opriate |
|00001590| 5c 73 61 6d 70 7b 52 45 | 54 52 7d 20 63 6f 6d 6d |\samp{RE|TR} comm|
|000015a0| 61 6e 64 20 28 73 65 65 | 0a 5c 63 6f 64 65 7b 72 |and (see|.\code{r|
|000015b0| 65 74 72 62 69 6e 61 72 | 79 28 29 7d 20 6f 72 20 |etrbinar|y()} or |
|000015c0| 61 20 5c 73 61 6d 70 7b | 4c 49 53 54 7d 20 63 6f |a \samp{|LIST} co|
|000015d0| 6d 6d 61 6e 64 20 28 75 | 73 75 61 6c 6c 79 20 6a |mmand (u|sually j|
|000015e0| 75 73 74 20 74 68 65 20 | 73 74 72 69 6e 67 0a 5c |ust the |string.\|
|000015f0| 63 6f 64 65 7b 22 4c 49 | 53 54 22 7d 29 2e 20 20 |code{"LI|ST"}). |
|00001600| 54 68 65 20 5c 76 61 72 | 7b 63 61 6c 6c 62 61 63 |The \var|{callbac|
|00001610| 6b 7d 20 66 75 6e 63 74 | 69 6f 6e 20 69 73 20 63 |k} funct|ion is c|
|00001620| 61 6c 6c 65 64 20 66 6f | 72 20 65 61 63 68 20 6c |alled fo|r each l|
|00001630| 69 6e 65 2c 0a 77 69 74 | 68 20 74 68 65 20 74 72 |ine,.wit|h the tr|
|00001640| 61 69 6c 69 6e 67 20 43 | 52 4c 46 20 73 74 72 69 |ailing C|RLF stri|
|00001650| 70 70 65 64 2e 20 20 54 | 68 65 20 64 65 66 61 75 |pped. T|he defau|
|00001660| 6c 74 20 5c 76 61 72 7b | 63 61 6c 6c 62 61 63 6b |lt \var{|callback|
|00001670| 7d 20 70 72 69 6e 74 73 | 0a 74 68 65 20 6c 69 6e |} prints|.the lin|
|00001680| 65 20 74 6f 20 5c 63 6f | 64 65 7b 73 79 73 2e 73 |e to \co|de{sys.s|
|00001690| 74 64 6f 75 74 7d 2e 0a | 5c 65 6e 64 7b 66 75 6e |tdout}..|\end{fun|
|000016a0| 63 64 65 73 63 7d 0a 0a | 5c 62 65 67 69 6e 7b 66 |cdesc}..|\begin{f|
|000016b0| 75 6e 63 64 65 73 63 7d | 7b 73 74 6f 72 62 69 6e |uncdesc}|{storbin|
|000016c0| 61 72 79 7d 7b 63 6f 6d | 6d 61 6e 64 5c 2c 20 66 |ary}{com|mand\, f|
|000016d0| 69 6c 65 5c 2c 20 62 6c | 6f 63 6b 73 69 7a 65 7d |ile\, bl|ocksize}|
|000016e0| 0a 53 74 6f 72 65 20 61 | 20 66 69 6c 65 20 69 6e |.Store a| file in|
|000016f0| 20 62 69 6e 61 72 79 20 | 74 72 61 6e 73 66 65 72 | binary |transfer|
|00001700| 20 6d 6f 64 65 2e 20 20 | 5c 76 61 72 7b 63 6f 6d | mode. |\var{com|
|00001710| 6d 61 6e 64 7d 20 73 68 | 6f 75 6c 64 20 62 65 20 |mand} sh|ould be |
|00001720| 61 6e 0a 61 70 70 72 6f | 70 72 69 61 74 65 20 5c |an.appro|priate \|
|00001730| 73 61 6d 70 7b 53 54 4f | 52 7d 20 63 6f 6d 6d 61 |samp{STO|R} comma|
|00001740| 6e 64 2c 20 69 2e 65 2e | 5c 20 5c 63 6f 64 65 7b |nd, i.e.|\ \code{|
|00001750| 22 53 54 4f 52 20 5c 76 | 61 72 7b 66 69 6c 65 6e |"STOR \v|ar{filen|
|00001760| 61 6d 65 7d 22 7d 2e 0a | 5c 76 61 72 7b 66 69 6c |ame}"}..|\var{fil|
|00001770| 65 7d 20 69 73 20 61 6e | 20 6f 70 65 6e 20 66 69 |e} is an| open fi|
|00001780| 6c 65 20 6f 62 6a 65 63 | 74 20 77 68 69 63 68 20 |le objec|t which |
|00001790| 69 73 20 72 65 61 64 20 | 75 6e 74 69 6c 20 45 4f |is read |until EO|
|000017a0| 46 20 75 73 69 6e 67 20 | 69 74 73 0a 5c 63 6f 64 |F using |its.\cod|
|000017b0| 65 7b 72 65 61 64 28 29 | 7d 20 6d 65 74 68 6f 64 |e{read()|} method|
|000017c0| 20 69 6e 20 62 6c 6f 63 | 6b 73 20 6f 66 20 73 69 | in bloc|ks of si|
|000017d0| 7a 65 20 5c 76 61 72 7b | 62 6c 6f 63 6b 73 69 7a |ze \var{|blocksiz|
|000017e0| 65 7d 20 74 6f 20 70 72 | 6f 76 69 64 65 20 74 68 |e} to pr|ovide th|
|000017f0| 65 0a 64 61 74 61 20 74 | 6f 20 62 65 20 73 74 6f |e.data t|o be sto|
|00001800| 72 65 64 2e 0a 5c 65 6e | 64 7b 66 75 6e 63 64 65 |red..\en|d{funcde|
|00001810| 73 63 7d 0a 0a 5c 62 65 | 67 69 6e 7b 66 75 6e 63 |sc}..\be|gin{func|
|00001820| 64 65 73 63 7d 7b 73 74 | 6f 72 6c 69 6e 65 73 7d |desc}{st|orlines}|
|00001830| 7b 63 6f 6d 6d 61 6e 64 | 5c 2c 20 66 69 6c 65 7d |{command|\, file}|
|00001840| 0a 53 74 6f 72 65 20 61 | 20 66 69 6c 65 20 69 6e |.Store a| file in|
|00001850| 20 5c 41 53 43 49 49 7b | 7d 20 74 72 61 6e 73 66 | \ASCII{|} transf|
|00001860| 65 72 20 6d 6f 64 65 2e | 20 20 5c 76 61 72 7b 63 |er mode.| \var{c|
|00001870| 6f 6d 6d 61 6e 64 7d 20 | 73 68 6f 75 6c 64 20 62 |ommand} |should b|
|00001880| 65 20 61 6e 0a 61 70 70 | 72 6f 70 72 69 61 74 65 |e an.app|ropriate|
|00001890| 20 5c 73 61 6d 70 7b 53 | 54 4f 52 7d 20 63 6f 6d | \samp{S|TOR} com|
|000018a0| 6d 61 6e 64 20 28 73 65 | 65 20 5c 63 6f 64 65 7b |mand (se|e \code{|
|000018b0| 73 74 6f 72 62 69 6e 61 | 72 79 28 29 7d 29 2e 20 |storbina|ry()}). |
|000018c0| 20 4c 69 6e 65 73 20 61 | 72 65 0a 72 65 61 64 20 | Lines a|re.read |
|000018d0| 75 6e 74 69 6c 20 45 4f | 46 20 66 72 6f 6d 20 74 |until EO|F from t|
|000018e0| 68 65 20 6f 70 65 6e 20 | 66 69 6c 65 20 6f 62 6a |he open |file obj|
|000018f0| 65 63 74 20 5c 76 61 72 | 7b 66 69 6c 65 7d 20 75 |ect \var|{file} u|
|00001900| 73 69 6e 67 20 69 74 73 | 0a 5c 63 6f 64 65 7b 72 |sing its|.\code{r|
|00001910| 65 61 64 6c 69 6e 65 28 | 29 7d 20 6d 65 74 68 6f |eadline(|)} metho|
|00001920| 64 20 74 6f 20 70 72 69 | 76 69 64 65 20 74 68 65 |d to pri|vide the|
|00001930| 20 64 61 74 61 20 74 6f | 20 62 65 20 73 74 6f 72 | data to| be stor|
|00001940| 65 64 2e 0a 5c 65 6e 64 | 7b 66 75 6e 63 64 65 73 |ed..\end|{funcdes|
|00001950| 63 7d 0a 0a 5c 62 65 67 | 69 6e 7b 66 75 6e 63 64 |c}..\beg|in{funcd|
|00001960| 65 73 63 7d 7b 6e 6c 73 | 74 7d 7b 61 72 67 75 6d |esc}{nls|t}{argum|
|00001970| 65 6e 74 5c 6f 70 74 69 | 6f 6e 61 6c 7b 5c 2c 20 |ent\opti|onal{\, |
|00001980| 5c 6c 64 6f 74 73 7d 7d | 0a 52 65 74 75 72 6e 20 |\ldots}}|.Return |
|00001990| 61 20 6c 69 73 74 20 6f | 66 20 66 69 6c 65 73 20 |a list o|f files |
|000019a0| 61 73 20 72 65 74 75 72 | 6e 65 64 20 62 79 20 74 |as retur|ned by t|
|000019b0| 68 65 20 5c 73 61 6d 70 | 7b 4e 4c 53 54 7d 20 63 |he \samp|{NLST} c|
|000019c0| 6f 6d 6d 61 6e 64 2e 20 | 20 54 68 65 0a 6f 70 74 |ommand. | The.opt|
|000019d0| 69 6f 6e 61 6c 20 76 61 | 72 7b 61 72 67 75 6d 65 |ional va|r{argume|
|000019e0| 6e 74 7d 20 69 73 20 61 | 20 64 69 72 65 63 74 6f |nt} is a| directo|
|000019f0| 72 79 20 74 6f 20 6c 69 | 73 74 20 28 64 65 66 61 |ry to li|st (defa|
|00001a00| 75 6c 74 20 69 73 20 74 | 68 65 20 63 75 72 72 65 |ult is t|he curre|
|00001a10| 6e 74 0a 73 65 72 76 65 | 72 20 64 69 72 65 63 74 |nt.serve|r direct|
|00001a20| 6f 72 79 29 2e 20 20 4d | 75 6c 74 69 70 6c 65 20 |ory). M|ultiple |
|00001a30| 61 72 67 75 6d 65 6e 74 | 73 20 63 61 6e 20 62 65 |argument|s can be|
|00001a40| 20 75 73 65 64 20 74 6f | 20 70 61 73 73 0a 6e 6f | used to| pass.no|
|00001a50| 6e 2d 73 74 61 6e 64 61 | 72 64 20 6f 70 74 69 6f |n-standa|rd optio|
|00001a60| 6e 73 20 74 6f 20 74 68 | 65 20 5c 73 61 6d 70 7b |ns to th|e \samp{|
|00001a70| 4e 4c 53 54 7d 20 63 6f | 6d 6d 61 6e 64 2e 0a 5c |NLST} co|mmand..\|
|00001a80| 65 6e 64 7b 66 75 6e 63 | 64 65 73 63 7d 0a 0a 5c |end{func|desc}..\|
|00001a90| 62 65 67 69 6e 7b 66 75 | 6e 63 64 65 73 63 7d 7b |begin{fu|ncdesc}{|
|00001aa0| 64 69 72 7d 7b 61 72 67 | 75 6d 65 6e 74 5c 6f 70 |dir}{arg|ument\op|
|00001ab0| 74 69 6f 6e 61 6c 7b 5c | 2c 20 5c 6c 64 6f 74 73 |tional{\|, \ldots|
|00001ac0| 7d 7d 0a 52 65 74 75 72 | 6e 20 61 20 64 69 72 65 |}}.Retur|n a dire|
|00001ad0| 63 74 6f 72 79 20 6c 69 | 73 74 69 6e 67 20 61 73 |ctory li|sting as|
|00001ae0| 20 72 65 74 75 72 6e 65 | 64 20 62 79 20 74 68 65 | returne|d by the|
|00001af0| 20 5c 73 61 6d 70 7b 4c | 49 53 54 7d 20 63 6f 6d | \samp{L|IST} com|
|00001b00| 6d 61 6e 64 2c 20 61 73 | 0a 61 20 6c 69 73 74 20 |mand, as|.a list |
|00001b10| 6f 66 20 6c 69 6e 65 73 | 2e 20 20 54 68 65 20 6f |of lines|. The o|
|00001b20| 70 74 69 6f 6e 61 6c 20 | 76 61 72 7b 61 72 67 75 |ptional |var{argu|
|00001b30| 6d 65 6e 74 7d 20 69 73 | 20 61 20 64 69 72 65 63 |ment} is| a direc|
|00001b40| 74 6f 72 79 20 74 6f 20 | 6c 69 73 74 0a 28 64 65 |tory to |list.(de|
|00001b50| 66 61 75 6c 74 20 69 73 | 20 74 68 65 20 63 75 72 |fault is| the cur|
|00001b60| 72 65 6e 74 20 73 65 72 | 76 65 72 20 64 69 72 65 |rent ser|ver dire|
|00001b70| 63 74 6f 72 79 29 2e 20 | 20 4d 75 6c 74 69 70 6c |ctory). | Multipl|
|00001b80| 65 20 61 72 67 75 6d 65 | 6e 74 73 20 63 61 6e 20 |e argume|nts can |
|00001b90| 62 65 0a 75 73 65 64 20 | 74 6f 20 70 61 73 73 20 |be.used |to pass |
|00001ba0| 6e 6f 6e 2d 73 74 61 6e | 64 61 72 64 20 6f 70 74 |non-stan|dard opt|
|00001bb0| 69 6f 6e 73 20 74 6f 20 | 74 68 65 20 5c 73 61 6d |ions to |the \sam|
|00001bc0| 70 7b 4c 49 53 54 7d 20 | 63 6f 6d 6d 61 6e 64 2e |p{LIST} |command.|
|00001bd0| 20 20 49 66 20 74 68 65 | 0a 6c 61 73 74 20 61 72 | If the|.last ar|
|00001be0| 67 75 6d 65 6e 74 20 69 | 73 20 61 20 66 75 6e 63 |gument i|s a func|
|00001bf0| 74 69 6f 6e 2c 20 69 74 | 20 69 73 20 75 73 65 64 |tion, it| is used|
|00001c00| 20 61 73 20 61 20 5c 76 | 61 72 7b 63 61 6c 6c 62 | as a \v|ar{callb|
|00001c10| 61 63 6b 7d 20 66 75 6e | 63 74 69 6f 6e 0a 61 73 |ack} fun|ction.as|
|00001c20| 20 66 6f 72 20 5c 63 6f | 64 65 7b 72 65 74 72 6c | for \co|de{retrl|
|00001c30| 69 6e 65 73 28 29 7d 2e | 0a 5c 65 6e 64 7b 66 75 |ines()}.|.\end{fu|
|00001c40| 6e 63 64 65 73 63 7d 0a | 0a 5c 62 65 67 69 6e 7b |ncdesc}.|.\begin{|
|00001c50| 66 75 6e 63 64 65 73 63 | 7d 7b 72 65 6e 61 6d 65 |funcdesc|}{rename|
|00001c60| 7d 7b 66 72 6f 6d 6e 61 | 6d 65 5c 2c 20 74 6f 6e |}{fromna|me\, ton|
|00001c70| 61 6d 65 7d 0a 52 65 6e | 61 6d 65 20 66 69 6c 65 |ame}.Ren|ame file|
|00001c80| 20 5c 76 61 72 7b 66 72 | 6f 6d 6e 61 6d 65 7d 20 | \var{fr|omname} |
|00001c90| 6f 6e 20 74 68 65 20 73 | 65 72 76 65 72 20 74 6f |on the s|erver to|
|00001ca0| 20 5c 76 61 72 7b 74 6f | 6e 61 6d 65 7d 2e 0a 5c | \var{to|name}..\|
|00001cb0| 65 6e 64 7b 66 75 6e 63 | 64 65 73 63 7d 0a 0a 5c |end{func|desc}..\|
|00001cc0| 62 65 67 69 6e 7b 66 75 | 6e 63 64 65 73 63 7d 7b |begin{fu|ncdesc}{|
|00001cd0| 63 77 64 7d 7b 70 61 74 | 68 6e 61 6d 65 7d 0a 53 |cwd}{pat|hname}.S|
|00001ce0| 65 74 20 74 68 65 20 63 | 75 72 72 65 6e 74 20 64 |et the c|urrent d|
|00001cf0| 69 72 65 63 74 6f 72 79 | 20 6f 6e 20 74 68 65 20 |irectory| on the |
|00001d00| 73 65 72 76 65 72 2e 0a | 5c 65 6e 64 7b 66 75 6e |server..|\end{fun|
|00001d10| 63 64 65 73 63 7d 0a 0a | 5c 62 65 67 69 6e 7b 66 |cdesc}..|\begin{f|
|00001d20| 75 6e 63 64 65 73 63 7d | 7b 6d 6b 64 7d 7b 70 61 |uncdesc}|{mkd}{pa|
|00001d30| 74 68 6e 61 6d 65 7d 0a | 43 72 65 61 74 65 20 61 |thname}.|Create a|
|00001d40| 20 6e 65 77 20 64 69 72 | 65 63 74 6f 72 79 20 6f | new dir|ectory o|
|00001d50| 6e 20 74 68 65 20 73 65 | 72 76 65 72 2e 0a 5c 65 |n the se|rver..\e|
|00001d60| 6e 64 7b 66 75 6e 63 64 | 65 73 63 7d 0a 0a 5c 62 |nd{funcd|esc}..\b|
|00001d70| 65 67 69 6e 7b 66 75 6e | 63 64 65 73 63 7d 7b 70 |egin{fun|cdesc}{p|
|00001d80| 77 64 7d 7b 7d 0a 52 65 | 74 75 72 6e 20 74 68 65 |wd}{}.Re|turn the|
|00001d90| 20 70 61 74 68 6e 61 6d | 65 20 6f 66 20 74 68 65 | pathnam|e of the|
|00001da0| 20 63 75 72 72 65 6e 74 | 20 64 69 72 65 63 74 6f | current| directo|
|00001db0| 72 79 20 6f 6e 20 74 68 | 65 20 73 65 72 76 65 72 |ry on th|e server|
|00001dc0| 2e 0a 5c 65 6e 64 7b 66 | 75 6e 63 64 65 73 63 7d |..\end{f|uncdesc}|
|00001dd0| 0a 0a 5c 62 65 67 69 6e | 7b 66 75 6e 63 64 65 73 |..\begin|{funcdes|
|00001de0| 63 7d 7b 71 75 69 74 7d | 7b 7d 0a 53 65 6e 64 20 |c}{quit}|{}.Send |
|00001df0| 61 20 5c 73 61 6d 70 7b | 51 55 49 54 7d 20 63 6f |a \samp{|QUIT} co|
|00001e00| 6d 6d 61 6e 64 20 74 6f | 20 74 68 65 20 73 65 72 |mmand to| the ser|
|00001e10| 76 65 72 20 61 6e 64 20 | 63 6c 6f 73 65 20 74 68 |ver and |close th|
|00001e20| 65 20 63 6f 6e 6e 65 63 | 74 69 6f 6e 2e 0a 54 68 |e connec|tion..Th|
|00001e30| 69 73 20 69 73 20 74 68 | 65 20 60 60 70 6f 6c 69 |is is th|e ``poli|
|00001e40| 74 65 27 27 20 77 61 79 | 20 74 6f 20 63 6c 6f 73 |te'' way| to clos|
|00001e50| 65 20 61 20 63 6f 6e 6e | 65 63 74 69 6f 6e 2c 20 |e a conn|ection, |
|00001e60| 62 75 74 20 69 74 20 6d | 61 79 20 72 61 69 73 65 |but it m|ay raise|
|00001e70| 20 61 6e 0a 65 78 63 65 | 70 74 69 6f 6e 20 6f 66 | an.exce|ption of|
|00001e80| 20 74 68 65 20 73 65 72 | 76 65 72 20 72 65 70 6f | the ser|ver repo|
|00001e90| 6e 64 73 20 77 69 74 68 | 20 61 6e 20 65 72 72 6f |nds with| an erro|
|00001ea0| 72 20 74 6f 20 74 68 65 | 20 5c 63 6f 64 65 7b 51 |r to the| \code{Q|
|00001eb0| 55 49 54 7d 0a 63 6f 6d | 6d 61 6e 64 2e 0a 5c 65 |UIT}.com|mand..\e|
|00001ec0| 6e 64 7b 66 75 6e 63 64 | 65 73 63 7d 0a 0a 5c 62 |nd{funcd|esc}..\b|
|00001ed0| 65 67 69 6e 7b 66 75 6e | 63 64 65 73 63 7d 7b 63 |egin{fun|cdesc}{c|
|00001ee0| 6c 6f 73 65 7d 7b 7d 0a | 43 6c 6f 73 65 20 74 68 |lose}{}.|Close th|
|00001ef0| 65 20 63 6f 6e 6e 65 63 | 74 69 6f 6e 20 75 6e 69 |e connec|tion uni|
|00001f00| 6c 61 74 65 72 61 6c 6c | 79 2e 20 20 54 68 69 73 |laterall|y. This|
|00001f10| 20 73 68 6f 75 6c 64 20 | 6e 6f 74 20 62 65 20 61 | should |not be a|
|00001f20| 70 70 6c 69 65 64 20 74 | 6f 20 61 6e 0a 61 6c 72 |pplied t|o an.alr|
|00001f30| 65 61 64 79 20 63 6c 6f | 73 65 64 20 63 6f 6e 6e |eady clo|sed conn|
|00001f40| 65 63 74 69 6f 6e 20 28 | 65 2e 67 2e 5c 20 61 66 |ection (|e.g.\ af|
|00001f50| 74 65 72 20 61 20 73 75 | 63 63 65 73 73 66 75 6c |ter a su|ccessful|
|00001f60| 20 63 61 6c 6c 20 74 6f | 0a 5c 63 6f 64 65 7b 71 | call to|.\code{q|
|00001f70| 75 69 74 28 29 7d 2e 0a | 5c 65 6e 64 7b 66 75 6e |uit()}..|\end{fun|
|00001f80| 63 64 65 73 63 7d 0a | |cdesc}. | |
+--------+-------------------------+-------------------------+--------+--------+