Artifact
436e64e3c2096cc66d0531e5204d8579fb49b500b418525b81049e0a59471841:
0000: 54 68 69 73 20 64 69 72 65 63 74 6f 72 79 20 63 This directory c
0010: 6f 6e 74 61 69 6e 20 65 78 61 6d 70 6c 65 20 66 ontain example f
0020: 69 6c 65 73 20 66 6f 72 20 68 6f 77 20 74 6f 20 iles for how to
0030: 75 73 65 20 74 68 65 20 54 4c 53 20 70 61 63 6b use the TLS pack
0040: 61 67 65 20 74 6f 20 70 65 72 66 6f 72 6d 0a 63 age to perform.c
0050: 6f 6d 6d 6f 6e 20 66 75 6e 63 74 69 6f 6e 73 2e ommon functions.
0060: 20 54 68 65 73 65 20 61 72 65 20 6a 75 73 74 20 These are just
0070: 61 20 66 65 77 20 6f 66 20 74 68 65 20 70 6f 73 a few of the pos
0080: 73 69 62 69 6c 69 74 69 65 73 2e 0a 0a 65 63 68 sibilities...ech
0090: 61 74 2e 74 63 6c 0a 45 78 61 6d 70 6c 65 20 65 at.tcl.Example e
00a0: 63 68 6f 20 63 68 61 74 20 74 6f 6f 6c 2e 20 53 cho chat tool. S
00b0: 74 61 72 74 20 77 69 74 68 20 2d 73 65 72 76 65 tart with -serve
00c0: 72 20 6f 72 20 2d 63 6c 69 65 6e 74 20 61 72 67 r or -client arg
00d0: 20 74 6f 20 73 65 74 20 63 6c 69 65 6e 74 2f 73 to set client/s
00e0: 65 72 76 65 72 20 6d 6f 64 65 2e 0a 0a 67 65 74 erver mode...get
00f0: 73 5f 62 6c 6f 63 6b 69 6e 67 5f 6e 6f 5f 76 61 s_blocking_no_va
0100: 72 69 61 62 6c 65 2e 74 63 6c 0a 44 6f 77 6e 6c riable.tcl.Downl
0110: 6f 61 64 20 61 20 77 65 62 70 61 67 65 20 75 73 oad a webpage us
0120: 69 6e 67 20 67 65 74 73 2c 20 6e 6f 20 76 61 72 ing gets, no var
0130: 69 61 62 6c 65 20 61 72 67 2c 20 61 6e 64 20 62 iable arg, and b
0140: 6c 6f 63 6b 69 6e 67 20 49 2f 4f 2e 0a 0a 67 65 locking I/O...ge
0150: 74 73 5f 62 6c 6f 63 6b 69 6e 67 5f 77 69 74 68 ts_blocking_with
0160: 5f 76 61 72 69 61 62 6c 65 2e 74 63 6c 0a 44 6f _variable.tcl.Do
0170: 77 6e 6c 6f 61 64 20 61 20 77 65 62 70 61 67 65 wnload a webpage
0180: 20 75 73 69 6e 67 20 67 65 74 73 2c 20 76 61 72 using gets, var
0190: 69 61 62 6c 65 20 61 72 67 2c 20 61 6e 64 20 62 iable arg, and b
01a0: 6c 6f 63 6b 69 6e 67 20 49 2f 4f 2e 0a 0a 67 65 locking I/O...ge
01b0: 74 73 5f 6e 6f 6e 62 6c 6f 63 6b 69 6e 67 5f 6e ts_nonblocking_n
01c0: 6f 5f 76 61 72 69 61 62 6c 65 2e 74 63 6c 0a 44 o_variable.tcl.D
01d0: 6f 77 6e 6c 6f 61 64 20 61 20 77 65 62 70 61 67 ownload a webpag
01e0: 65 20 75 73 69 6e 67 20 67 65 74 73 2c 20 6e 6f e using gets, no
01f0: 20 76 61 72 69 61 62 6c 65 20 61 72 67 2c 20 61 variable arg, a
0200: 6e 64 20 6e 6f 6e 2d 62 6c 6f 63 6b 69 6e 67 20 nd non-blocking
0210: 49 2f 4f 2e 0a 0a 67 65 74 73 5f 6e 6f 6e 62 6c I/O...gets_nonbl
0220: 6f 63 6b 69 6e 67 5f 77 69 74 68 5f 76 61 72 69 ocking_with_vari
0230: 61 62 6c 65 2e 74 63 6c 0a 44 6f 77 6e 6c 6f 61 able.tcl.Downloa
0240: 64 20 61 20 77 65 62 70 61 67 65 20 75 73 69 6e d a webpage usin
0250: 67 20 67 65 74 73 2c 20 76 61 72 69 61 62 6c 65 g gets, variable
0260: 20 61 72 67 2c 20 61 6e 64 20 6e 6f 6e 2d 62 6c arg, and non-bl
0270: 6f 63 6b 69 6e 67 20 49 2f 4f 2e 0a 0a 67 65 74 ocking I/O...get
0280: 73 5f 77 69 74 68 5f 64 65 62 75 67 5f 64 61 74 s_with_debug_dat
0290: 61 2e 74 63 6c 0a 44 6f 77 6e 6c 6f 61 64 20 61 a.tcl.Download a
02a0: 20 77 65 62 70 61 67 65 20 75 73 69 6e 67 20 67 webpage using g
02b0: 65 74 73 20 77 69 74 68 20 61 64 64 69 74 69 6f ets with additio
02c0: 6e 61 6c 20 64 65 62 75 67 20 6f 75 74 70 75 74 nal debug output
02d0: 2e 0a 0a 68 74 74 70 5f 64 65 62 75 67 5f 65 78 ...http_debug_ex
02e0: 61 6d 70 6c 65 2e 74 63 6c 0a 44 6f 77 6e 6c 6f ample.tcl.Downlo
02f0: 61 64 20 61 20 77 65 62 70 61 67 65 20 75 73 69 ad a webpage usi
0300: 6e 67 20 68 74 74 70 20 70 61 63 6b 61 67 65 20 ng http package
0310: 77 69 74 68 20 61 64 64 69 74 69 6f 6e 61 6c 20 with additional
0320: 64 65 62 75 67 20 6f 75 74 70 75 74 2e 0a 0a 68 debug output...h
0330: 74 74 70 5f 67 65 74 5f 66 69 6c 65 2e 74 63 6c ttp_get_file.tcl
0340: 0a 44 6f 77 6e 6c 6f 61 64 20 61 20 66 69 6c 65 .Download a file
0350: 20 75 73 69 6e 67 20 74 68 65 20 68 74 74 70 20 using the http
0360: 70 61 63 6b 61 67 65 2e 0a 0a 68 74 74 70 5f 67 package...http_g
0370: 65 74 5f 77 65 62 70 61 67 65 2e 74 63 6c 0a 44 et_webpage.tcl.D
0380: 6f 77 6e 6c 6f 61 64 20 61 20 77 65 62 70 61 67 ownload a webpag
0390: 65 20 75 73 69 6e 67 20 74 68 65 20 68 74 74 70 e using the http
03a0: 20 70 61 63 6b 61 67 65 2e 0a 0a 68 74 74 70 5f package...http_
03b0: 67 65 74 5f 77 65 62 70 61 67 65 5f 70 72 6f 78 get_webpage_prox
03c0: 79 2e 74 63 6c 0a 44 6f 77 6e 6c 6f 61 64 20 61 y.tcl.Download a
03d0: 20 66 69 6c 65 20 75 73 69 6e 67 20 74 68 65 20 file using the
03e0: 68 74 74 70 20 61 6e 64 20 61 75 74 6f 70 72 6f http and autopro
03f0: 78 79 20 70 61 63 6b 61 67 65 73 2e 0a 0a 72 65 xy packages...re
0400: 61 64 5f 62 6c 6f 63 6b 69 6e 67 5f 77 65 62 70 ad_blocking_webp
0410: 61 67 65 2e 74 63 6c 0a 44 6f 77 6e 6c 6f 61 64 age.tcl.Download
0420: 20 61 20 77 65 62 70 61 67 65 20 75 73 69 6e 67 a webpage using
0430: 20 72 65 61 64 20 61 6e 64 20 62 6c 6f 63 6b 69 read and blocki
0440: 6e 67 20 49 2f 4f 2e 0a 0a 72 65 61 64 5f 6e 6f ng I/O...read_no
0450: 6e 62 6c 6f 63 6b 69 6e 67 5f 77 65 62 70 61 67 nblocking_webpag
0460: 65 2e 74 63 6c 0a 44 6f 77 6e 6c 6f 61 64 20 61 e.tcl.Download a
0470: 20 77 65 62 70 61 67 65 20 75 73 69 6e 67 20 72 webpage using r
0480: 65 61 64 20 61 6e 64 20 6e 6f 6e 2d 62 6c 6f 63 ead and non-bloc
0490: 6b 69 6e 67 20 49 2f 4f 2e 0a 0a king I/O...