home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 15 / BBS in a box XV-2.iso / Files II / Prog / S / Simple Sockets 1.0.1.sit / Simple Sockets 1.0.1 ƒ / Simple Sockets Manual < prev    next >
MacBinary  |  1995-06-04  |  25.0 KB  |  [TEXT/R*ch]

open in: MacOS 8.1     |     Win98     |     DOS

view JSON data     |     view as text

This file was processed as: MacBinary (archive/macBinary).

You can browse this item here: Simple Sockets Manual

ConfidenceProgramDetectionMatch TypeSupport
10% dexvert MacBinary (archive/macBinary) fallback Supported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, Sun Jun 4 22:45:35 1995, modified Sun Jun 4 22:45:35 1995, creator BBEdit, type ASCII, 24609 bytes "Simple Sockets Manual" , at 0x60a1 670 bytes resource default (weak)
99% file data default
74% TrID Macintosh plain text (MacBinary) default
25% TrID MacBinary 2 default (weak)
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[R*ch]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 15 53 69 6d 70 6c 65 | 20 53 6f 63 6b 65 74 73 |..Simple| Sockets|
|00000010| 20 4d 61 6e 75 61 6c 00 | 00 00 00 00 00 00 00 00 | Manual.|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 52 2a 63 | 68 00 00 00 00 00 00 00 |.TEXTR*c|h.......|
|00000050| 00 00 00 00 00 60 21 00 | 00 02 9e ab f8 20 4f ab |.....`!.|..... O.|
|00000060| f8 20 4f 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |. O.....|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 c5 fa 00 00 |........|........|
|00000080| 53 69 6d 70 6c 65 20 53 | 6f 63 6b 65 74 73 20 76 |Simple S|ockets v|
|00000090| 20 31 2e 30 2e 31 0d 4d | 61 69 6e 74 65 6e 61 6e | 1.0.1.M|aintenan|
|000000a0| 63 65 20 52 65 6c 65 61 | 73 65 0d 0d 62 79 20 4d |ce Relea|se..by M|
|000000b0| 69 63 68 61 65 6c 20 54 | 72 65 6e 74 2e 0d 0d 30 |ichael T|rent...0|
|000000c0| 2e 20 4d 61 6e 75 61 6c | 20 4f 76 65 72 76 69 65 |. Manual| Overvie|
|000000d0| 77 0d 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |w.~~~~~~|~~~~~~~~|
|000000e0| 7e 7e 7e 7e 0d 28 6e 6f | 74 20 71 75 69 74 65 20 |~~~~.(no|t quite |
|000000f0| 61 20 74 61 62 6c 65 20 | 6f 66 20 63 6f 6e 74 65 |a table |of conte|
|00000100| 6e 74 73 20 2e 2e 2e 20 | 77 68 61 74 20 77 69 74 |nts ... |what wit|
|00000110| 68 20 6e 6f 20 70 61 67 | 65 20 6e 75 6d 62 65 72 |h no pag|e number|
|00000120| 73 20 61 6e 64 20 61 6c | 6c 29 0d 0d 53 65 63 74 |s and al|l)..Sect|
|00000130| 69 6f 6e 09 09 09 09 54 | 6f 70 69 63 0d 0d 20 20 |ion....T|opic.. |
|00000140| 20 31 2e 20 2e 20 2e 20 | 2e 20 2e 20 2e 20 2e 20 | 1. . . |. . . . |
|00000150| 2e 20 49 6e 74 72 6f 64 | 75 63 74 69 6f 6e 0d 20 |. Introd|uction. |
|00000160| 20 20 32 2e 20 2e 20 2e | 20 2e 20 2e 20 2e 20 2e | 2. . .| . . . .|
|00000170| 20 2e 20 44 69 73 74 72 | 69 62 75 74 69 6f 6e 0d | . Distr|ibution.|
|00000180| 20 20 20 33 2e 20 2e 20 | 2e 20 2e 20 2e 20 2e 20 | 3. . |. . . . |
|00000190| 2e 20 2e 20 49 6e 73 74 | 61 6c 6c 61 74 69 6f 6e |. . Inst|allation|
|000001a0| 0d 20 20 20 34 2e 20 2e | 20 2e 20 2e 20 2e 20 2e |. 4. .| . . . .|
|000001b0| 20 2e 20 2e 20 55 73 69 | 6e 67 20 53 69 6d 70 6c | . . Usi|ng Simpl|
|000001c0| 65 20 53 6f 63 6b 65 74 | 73 0d 20 20 20 35 2e 20 |e Socket|s. 5. |
|000001d0| 2e 20 2e 20 2e 20 2e 20 | 2e 20 2e 20 2e 20 53 69 |. . . . |. . . Si|
|000001e0| 6d 70 6c 65 20 53 6f 63 | 6b 65 74 20 52 6f 75 74 |mple Soc|ket Rout|
|000001f0| 69 6e 65 73 0d 20 20 20 | 36 2e 20 2e 20 2e 20 2e |ines. |6. . . .|
|00000200| 20 2e 20 2e 20 2e 20 2e | 20 4d 61 6b 69 6e 67 20 | . . . .| Making |
|00000210| 59 6f 75 72 20 4f 77 6e | 20 53 70 69 6e 20 52 6f |Your Own| Spin Ro|
|00000220| 75 74 69 6e 65 73 0d 20 | 20 20 37 2e 20 2e 20 2e |utines. | 7. . .|
|00000230| 20 2e 20 2e 20 2e 20 2e | 20 2e 20 45 72 72 6f 72 | . . . .| . Error|
|00000240| 20 48 61 6e 64 6c 69 6e | 67 0d 20 20 20 38 2e 20 | Handlin|g. 8. |
|00000250| 2e 20 2e 20 2e 20 2e 20 | 2e 20 2e 20 2e 20 53 75 |. . . . |. . . Su|
|00000260| 67 67 65 73 74 65 64 20 | 52 65 61 64 69 6e 67 20 |ggested |Reading |
|00000270| 4c 69 73 74 0d 20 20 20 | 39 2e 20 2e 20 2e 20 2e |List. |9. . . .|
|00000280| 20 2e 20 2e 20 2e 20 2e | 20 53 69 6d 70 6c 65 20 | . . . .| Simple |
|00000290| 53 6f 63 6b 65 74 73 20 | 4c 69 63 65 6e 73 65 20 |Sockets |License |
|000002a0| 41 67 72 65 65 6d 65 6e | 74 0d 0d 0d 31 2e 20 49 |Agreemen|t...1. I|
|000002b0| 6e 74 72 6f 64 75 63 74 | 69 6f 6e 0d 7e 7e 7e 7e |ntroduct|ion.~~~~|
|000002c0| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 0d 0d 53 69 6d |~~~~~~~~|~~~..Sim|
|000002d0| 70 6c 65 20 53 6f 63 6b | 65 74 73 20 61 72 6f 73 |ple Sock|ets aros|
|000002e0| 65 20 6f 75 74 20 6f 66 | 20 61 6e 20 65 66 66 6f |e out of| an effo|
|000002f0| 72 74 20 74 6f 20 70 6f | 72 74 20 53 75 6e 20 4d |rt to po|rt Sun M|
|00000300| 69 63 72 6f 73 79 73 74 | 65 6d 73 27 73 20 52 50 |icrosyst|ems's RP|
|00000310| 43 53 52 43 20 34 2e 30 | 20 74 6f 0d 74 68 65 20 |CSRC 4.0| to.the |
|00000320| 4d 61 63 69 6e 74 6f 73 | 68 20 6f 70 65 72 61 74 |Macintos|h operat|
|00000330| 69 6e 67 20 73 79 73 74 | 65 6d 2c 20 75 73 69 6e |ing syst|em, usin|
|00000340| 67 20 4d 61 63 54 43 50 | 20 66 6f 72 20 54 43 50 |g MacTCP| for TCP|
|00000350| 2f 49 50 20 61 6e 64 20 | 55 44 50 2f 49 50 20 73 |/IP and |UDP/IP s|
|00000360| 75 70 70 6f 72 74 2e 20 | 20 52 50 43 0d 72 65 6c |upport. | RPC.rel|
|00000370| 69 65 73 20 6f 6e 20 42 | 53 44 20 55 4e 49 58 20 |ies on B|SD UNIX |
|00000380| 73 6f 63 6b 65 74 20 63 | 61 6c 6c 73 20 66 6f 72 |socket c|alls for|
|00000390| 20 49 6e 74 65 72 20 50 | 72 6f 63 65 73 73 20 43 | Inter P|rocess C|
|000003a0| 6f 6d 6d 75 6e 69 63 61 | 74 69 6f 6e 2c 20 6c 69 |ommunica|tion, li|
|000003b0| 6b 65 20 61 6e 79 20 67 | 6f 6f 64 0d 55 4e 49 58 |ke any g|ood.UNIX|
|000003c0| 20 73 6f 66 74 77 61 72 | 65 20 73 68 6f 75 6c 64 | softwar|e should|
|000003d0| 2e 20 20 41 66 74 65 72 | 20 74 69 6e 6b 65 72 69 |. After| tinkeri|
|000003e0| 6e 67 20 77 69 74 68 20 | 61 20 6e 75 6d 62 65 72 |ng with |a number|
|000003f0| 20 6f 66 20 73 6f 63 6b | 65 74 20 73 6f 6c 75 74 | of sock|et solut|
|00000400| 69 6f 6e 73 20 66 6f 72 | 20 74 68 65 0d 4d 61 63 |ions for| the.Mac|
|00000410| 69 6e 74 6f 73 68 20 28 | 47 55 53 49 2c 20 73 6f |intosh (|GUSI, so|
|00000420| 6d 65 20 77 65 69 72 64 | 20 42 53 44 20 73 6f 75 |me weird| BSD sou|
|00000430| 72 63 65 20 49 20 72 65 | 63 65 69 76 65 64 20 66 |rce I re|ceived f|
|00000440| 72 6f 6d 20 55 6e 69 76 | 65 72 73 69 74 79 20 6f |rom Univ|ersity o|
|00000450| 66 20 54 6f 72 6f 6e 74 | 6f 2c 20 61 6e 64 0d 73 |f Toront|o, and.s|
|00000460| 6f 20 6f 6e 29 2c 20 49 | 20 64 65 63 69 64 65 64 |o on), I| decided|
|00000470| 20 74 6f 20 62 69 74 65 | 20 74 68 65 20 62 75 6c | to bite| the bul|
|00000480| 6c 65 74 20 61 6e 64 20 | 73 69 6d 75 6c 61 74 65 |let and |simulate|
|00000490| 20 42 53 44 20 73 6f 63 | 6b 65 74 73 20 6d 79 73 | BSD soc|kets mys|
|000004a0| 65 6c 66 2e 0d 0d 42 53 | 44 20 63 6f 6d 70 61 74 |elf...BS|D compat|
|000004b0| 69 62 69 6c 69 74 79 20 | 68 61 73 20 6e 6f 74 20 |ibility |has not |
|000004c0| 62 65 65 6e 20 6d 79 20 | 70 72 69 6d 61 72 79 20 |been my |primary |
|000004d0| 67 6f 61 6c 20 68 6f 77 | 65 76 65 72 2e 20 20 54 |goal how|ever. T|
|000004e0| 68 65 72 65 20 61 72 65 | 20 61 20 6e 75 6d 62 65 |here are| a numbe|
|000004f0| 72 20 6f 66 0d 66 61 63 | 65 74 73 20 6f 66 20 55 |r of.fac|ets of U|
|00000500| 4e 49 58 20 73 6f 63 6b | 65 74 20 63 61 6c 6c 73 |NIX sock|et calls|
|00000510| 20 74 68 61 74 20 61 72 | 65 20 61 72 74 69 66 61 | that ar|e artifa|
|00000520| 63 74 73 20 6f 66 20 65 | 61 72 6c 69 65 72 20 73 |cts of e|arlier s|
|00000530| 79 73 74 65 6d 73 2c 20 | 72 65 6d 61 69 6e 69 6e |ystems, |remainin|
|00000540| 67 20 66 6f 72 0d 62 61 | 63 6b 77 61 72 64 73 20 |g for.ba|ckwards |
|00000550| 63 6f 6d 70 61 74 69 62 | 69 6c 69 74 79 2e 20 20 |compatib|ility. |
|00000560| 41 6c 73 6f 20 73 6f 63 | 6b 65 74 20 63 61 6c 6c |Also soc|ket call|
|00000570| 73 20 61 72 65 20 64 65 | 73 69 67 6e 65 64 20 74 |s are de|signed t|
|00000580| 6f 20 62 65 20 6d 6f 72 | 65 20 66 6c 65 78 69 62 |o be mor|e flexib|
|00000590| 6c 65 20 74 68 61 6e 0d | 4d 61 63 54 43 50 20 63 |le than.|MacTCP c|
|000005a0| 61 6e 20 62 65 2e 20 20 | 53 6f 2c 20 73 6f 6d 65 |an be. |So, some|
|000005b0| 20 63 61 6c 6c 73 20 77 | 65 72 65 20 73 69 6d 70 | calls w|ere simp|
|000005c0| 6c 69 66 69 65 64 20 61 | 20 62 69 74 20 66 6f 72 |lified a| bit for|
|000005d0| 20 74 68 65 20 73 61 6b | 65 20 6f 66 20 22 70 72 | the sak|e of "pr|
|000005e0| 6f 67 72 65 73 73 22 2e | 0d 0d 41 73 20 61 20 72 |ogress".|..As a r|
|000005f0| 65 73 75 6c 74 2c 20 6d | 6f 73 74 20 55 4e 49 58 |esult, m|ost UNIX|
|00000600| 20 73 6f 63 6b 65 74 20 | 63 6f 64 65 20 77 6f 6e | socket |code won|
|00000610| 27 74 20 63 6f 6d 70 69 | 6c 65 20 77 69 74 68 6f |'t compi|le witho|
|00000620| 75 74 20 73 6f 6d 65 20 | 6d 6f 64 69 66 69 63 61 |ut some |modifica|
|00000630| 74 69 6f 6e 0d 28 70 65 | 72 68 61 70 73 20 74 68 |tion.(pe|rhaps th|
|00000640| 69 73 20 6d 61 6b 65 73 | 20 74 68 65 20 63 6f 64 |is makes| the cod|
|00000650| 65 20 75 73 65 6c 65 73 | 73 20 74 6f 20 6d 6f 73 |e useles|s to mos|
|00000660| 74 20 70 65 6f 70 6c 65 | 29 2e 20 20 41 73 20 74 |t people|). As t|
|00000670| 69 6d 65 20 70 65 72 6d | 69 74 73 2c 20 49 20 68 |ime perm|its, I h|
|00000680| 6f 70 65 20 74 6f 0d 63 | 6c 6f 73 65 20 74 68 65 |ope to.c|lose the|
|00000690| 20 67 61 70 20 62 65 74 | 77 65 65 6e 20 53 69 6d | gap bet|ween Sim|
|000006a0| 70 6c 65 20 53 6f 63 6b | 65 74 73 20 61 6e 64 20 |ple Sock|ets and |
|000006b0| 42 53 44 20 73 6f 63 6b | 65 74 73 20 61 20 6c 69 |BSD sock|ets a li|
|000006c0| 74 74 6c 65 20 6d 6f 72 | 65 2e 0d 0d 4f 6e 20 74 |ttle mor|e...On t|
|000006d0| 68 65 20 6f 66 66 20 63 | 68 61 6e 63 65 20 74 68 |he off c|hance th|
|000006e0| 61 74 20 73 6f 6d 65 6f | 6e 65 20 6d 69 67 68 74 |at someo|ne might|
|000006f0| 20 66 69 6e 64 20 74 68 | 69 73 20 63 6f 64 65 20 | find th|is code |
|00000700| 75 73 65 66 75 6c 2c 20 | 49 20 61 6d 20 77 69 6c |useful, |I am wil|
|00000710| 6c 69 6e 67 6c 79 20 67 | 69 76 69 6e 67 0d 61 6c |lingly g|iving.al|
|00000720| 6c 20 74 68 69 73 20 63 | 6f 64 65 20 75 70 20 69 |l this c|ode up i|
|00000730| 6e 74 6f 20 74 68 65 20 | 50 75 62 6c 69 63 20 44 |nto the |Public D|
|00000740| 6f 6d 61 69 6e 20 28 6d | 79 20 66 72 69 65 6e 64 |omain (m|y friend|
|00000750| 73 20 73 61 79 20 22 53 | 65 6c 6c 20 49 74 21 20 |s say "S|ell It! |
|00000760| 53 65 6c 6c 20 49 74 21 | 22 2c 20 62 75 74 0d 73 |Sell It!|", but.s|
|00000770| 6f 6d 65 20 70 65 72 76 | 65 72 73 65 20 73 65 6e |ome perv|erse sen|
|00000780| 73 65 20 6f 66 20 76 69 | 72 74 75 65 20 70 72 65 |se of vi|rtue pre|
|00000790| 76 65 6e 74 73 20 6d 65 | 20 66 72 6f 6d 20 63 68 |vents me| from ch|
|000007a0| 61 72 67 69 6e 67 20 6d | 6f 6e 65 79 20 66 6f 72 |arging m|oney for|
|000007b0| 20 61 6e 79 74 68 69 6e | 67 20 49 0d 74 68 69 6e | anythin|g I.thin|
|000007c0| 6b 20 69 73 20 76 61 6c | 75 61 62 6c 65 20 2d 20 |k is val|uable - |
|000007d0| 73 65 65 20 6d 79 20 6e | 6f 74 6f 72 69 6f 75 73 |see my n|otorious|
|000007e0| 6c 79 20 75 6e 70 6f 70 | 75 6c 61 72 20 73 68 61 |ly unpop|ular sha|
|000007f0| 72 65 77 61 72 65 20 70 | 72 6f 67 72 61 6d 20 22 |reware p|rogram "|
|00000800| 43 50 55 20 52 65 70 6f | 72 74 65 72 22 0d 66 6f |CPU Repo|rter".fo|
|00000810| 72 20 74 68 65 20 63 6f | 72 72 6f 6c 6c 61 72 79 |r the co|rrollary|
|00000820| 3a 20 63 68 61 72 67 65 | 20 6d 6f 6e 65 79 20 66 |: charge| money f|
|00000830| 6f 72 20 75 73 65 6c 65 | 73 73 20 73 6f 66 74 77 |or usele|ss softw|
|00000840| 61 72 65 29 2e 20 20 49 | 66 20 73 6f 6d 65 6f 6e |are). I|f someon|
|00000850| 65 20 6f 75 74 20 74 68 | 65 72 65 0d 6d 61 6b 65 |e out th|ere.make|
|00000860| 73 20 73 6f 6d 65 20 63 | 68 61 6e 67 65 73 20 74 |s some c|hanges t|
|00000870| 6f 20 6d 79 20 63 6f 64 | 65 20 74 68 61 74 20 61 |o my cod|e that a|
|00000880| 72 65 20 76 61 6c 75 61 | 62 6c 65 20 61 64 64 69 |re valua|ble addi|
|00000890| 74 69 6f 6e 73 20 6f 72 | 20 62 75 67 20 66 69 78 |tions or| bug fix|
|000008a0| 65 73 2c 20 49 27 64 20 | 6c 6f 76 65 0d 74 6f 20 |es, I'd |love.to |
|000008b0| 68 65 61 72 20 61 62 6f | 75 74 20 69 74 2c 20 73 |hear abo|ut it, s|
|000008c0| 6f 20 49 20 63 61 6e 20 | 75 70 64 61 74 65 20 6d |o I can |update m|
|000008d0| 79 20 6d 61 73 74 65 72 | 20 63 6f 70 69 65 73 2e |y master| copies.|
|000008e0| 20 20 49 20 68 6f 70 65 | 20 74 6f 20 70 6f 73 74 | I hope| to post|
|000008f0| 20 75 70 64 61 74 65 73 | 20 74 6f 0d 74 68 65 20 | updates| to.the |
|00000900| 49 6e 66 6f 2d 4d 61 63 | 20 61 72 63 68 69 76 65 |Info-Mac| archive|
|00000910| 20 77 68 65 6e 2d 61 6e | 64 2d 69 66 20 63 68 61 | when-an|d-if cha|
|00000920| 6e 67 65 73 20 6f 63 63 | 75 72 2e 0d 0d 4f 66 20 |nges occ|ur...Of |
|00000930| 63 6f 75 72 73 65 2c 20 | 74 68 65 72 65 20 61 72 |course, |there ar|
|00000940| 65 20 6f 74 68 65 72 20 | 42 53 44 20 53 6f 63 6b |e other |BSD Sock|
|00000950| 65 74 20 69 6d 70 6c 65 | 6d 65 6e 74 61 74 69 6f |et imple|mentatio|
|00000960| 6e 73 20 6f 75 74 20 74 | 68 65 72 65 2c 20 73 6f |ns out t|here, so|
|00000970| 6d 65 20 6f 66 20 74 68 | 65 6d 0d 6d 75 63 68 20 |me of th|em.much |
|00000980| 62 65 74 74 65 72 20 74 | 68 61 6e 20 6d 79 20 68 |better t|han my h|
|00000990| 75 6d 62 6c 65 20 70 72 | 6f 6a 65 63 74 20 28 61 |umble pr|oject (a|
|000009a0| 67 61 69 6e 3a 20 47 55 | 53 49 29 2e 20 20 49 66 |gain: GU|SI). If|
|000009b0| 20 79 6f 75 20 74 68 69 | 6e 6b 20 74 68 69 73 20 | you thi|nk this |
|000009c0| 70 72 6f 6a 65 63 74 20 | 68 61 73 0d 61 6e 79 20 |project |has.any |
|000009d0| 76 61 6c 75 65 20 61 74 | 20 61 6c 6c 2c 20 70 6c |value at| all, pl|
|000009e0| 65 61 73 65 20 64 72 6f | 70 20 6d 65 20 61 20 6c |ease dro|p me a l|
|000009f0| 69 6e 65 2c 20 65 2d 20 | 6f 72 20 73 6e 61 69 6c |ine, e- |or snail|
|00000a00| 2d 20 6d 61 69 6c 2e 20 | 20 49 20 63 61 6e 20 62 |- mail. | I can b|
|00000a10| 65 20 72 65 61 63 68 65 | 64 20 61 74 3a 0d 0d 09 |e reache|d at:...|
|00000a20| 4d 69 63 68 61 65 6c 20 | 44 2e 20 54 72 65 6e 74 |Michael |D. Trent|
|00000a30| 0d 09 32 32 30 20 4e 2e | 20 53 6c 65 69 67 68 74 |..220 N.| Sleight|
|00000a40| 20 53 74 2e 0d 09 4e 61 | 70 65 72 76 69 6c 6c 65 | St...Na|perville|
|00000a50| 2c 20 49 4c 20 36 30 35 | 34 30 0d 09 0d 09 77 6f |, IL 605|40....wo|
|00000a60| 72 6b 20 65 2d 6d 61 69 | 6c 3a 20 20 6d 74 72 65 |rk e-mai|l: mtre|
|00000a70| 6e 74 40 65 70 69 63 73 | 79 73 2e 63 6f 6d 0d 09 |nt@epics|ys.com..|
|00000a80| 70 6c 65 61 73 75 72 65 | 20 65 2d 6d 61 69 6c 3a |pleasure| e-mail:|
|00000a90| 20 20 74 72 65 6e 74 6d | 64 40 73 74 75 2e 62 65 | trentm|d@stu.be|
|00000aa0| 6c 6f 69 74 2e 65 64 75 | 0d 0d 45 2d 6d 61 69 6c |loit.edu|..E-mail|
|00000ab0| 20 69 73 20 70 72 65 66 | 65 72 72 65 64 3b 20 20 | is pref|erred; |
|00000ac0| 49 20 6d 61 79 20 6e 6f | 74 20 72 65 63 65 69 76 |I may no|t receiv|
|00000ad0| 65 20 73 6e 61 69 6c 2d | 6d 61 69 6c 20 66 6f 72 |e snail-|mail for|
|00000ae0| 20 73 65 76 65 72 61 6c | 20 77 65 65 6b 73 2e 20 | several| weeks. |
|00000af0| 20 50 6c 65 61 73 65 20 | 74 72 79 0d 6d 79 20 22 | Please |try.my "|
|00000b00| 70 6c 65 61 73 75 72 65 | 22 20 65 2d 6d 61 69 6c |pleasure|" e-mail|
|00000b10| 20 66 69 72 73 74 20 d1 | 20 49 20 64 6f 20 63 68 | first .| I do ch|
|00000b20| 65 63 6b 20 69 74 20 64 | 61 69 6c 79 2e 20 20 55 |eck it d|aily. U|
|00000b30| 73 65 20 74 68 65 20 22 | 77 6f 72 6b 22 20 61 64 |se the "|work" ad|
|00000b40| 64 72 65 73 73 20 6f 6e | 6c 79 0d 69 66 2c 20 66 |dress on|ly.if, f|
|00000b50| 6f 72 20 77 68 61 74 65 | 76 65 72 20 72 65 61 73 |or whate|ver reas|
|00000b60| 6f 6e 2c 20 79 6f 75 20 | 63 61 6e 6e 6f 74 20 67 |on, you |cannot g|
|00000b70| 65 74 20 74 68 72 6f 75 | 67 68 20 74 6f 20 6d 79 |et throu|gh to my|
|00000b80| 20 73 74 75 2e 62 65 6c | 6f 69 74 2e 65 64 75 20 | stu.bel|oit.edu |
|00000b90| 61 63 63 6f 75 6e 74 2e | 20 0d 42 65 6c 6f 69 74 |account.| .Beloit|
|00000ba0| 27 73 20 69 6e 74 65 72 | 6e 65 74 20 61 63 63 65 |'s inter|net acce|
|00000bb0| 73 73 20 74 65 6e 64 73 | 20 74 6f 20 73 75 66 66 |ss tends| to suff|
|00000bc0| 65 72 20 72 65 70 65 61 | 74 65 64 20 22 75 6e 65 |er repea|ted "une|
|00000bd0| 78 70 6c 61 69 6e 61 62 | 6c 65 22 20 66 61 69 6c |xplainab|le" fail|
|00000be0| 75 72 65 73 2e 0d 0d 4f | 68 2c 20 61 6e 64 20 74 |ures...O|h, and t|
|00000bf0| 68 69 73 20 69 73 20 76 | 65 72 73 69 6f 6e 20 31 |his is v|ersion 1|
|00000c00| 2e 30 2e 31 2e 20 20 46 | 6f 72 20 61 20 73 68 6f |.0.1. F|or a sho|
|00000c10| 72 74 20 6c 69 73 74 20 | 6f 66 20 63 68 61 6e 67 |rt list |of chang|
|00000c20| 65 73 2c 20 73 65 65 20 | 74 68 65 20 22 52 65 61 |es, see |the "Rea|
|00000c30| 64 20 4d 65 0d 46 69 72 | 73 74 22 20 66 69 6c 65 |d Me.Fir|st" file|
|00000c40| 2c 20 69 66 20 79 6f 75 | 20 68 61 76 65 6e 27 74 |, if you| haven't|
|00000c50| 20 61 6c 72 65 61 64 79 | 2e 20 20 49 66 20 79 6f | already|. If yo|
|00000c60| 75 20 67 65 74 20 61 20 | 63 68 61 6e 63 65 2c 20 |u get a |chance, |
|00000c70| 67 6c 61 6e 63 65 20 61 | 74 20 22 54 6f 20 44 6f |glance a|t "To Do|
|00000c80| 22 20 61 73 0d 77 65 6c | 6c 2e 20 20 45 6e 6a 6f |" as.wel|l. Enjo|
|00000c90| 79 21 0d 0d 0d 32 2e 20 | 44 69 73 74 72 69 62 75 |y!...2. |Distribu|
|00000ca0| 74 69 6f 6e 0d 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |tion.~~~|~~~~~~~~|
|00000cb0| 7e 7e 7e 7e 0d 0d 54 68 | 65 20 53 69 6d 70 6c 65 |~~~~..Th|e Simple|
|00000cc0| 20 53 6f 63 6b 65 74 73 | 20 61 72 63 68 69 76 65 | Sockets| archive|
|00000cd0| 20 63 6f 6e 74 61 69 6e | 73 20 61 20 6e 75 6d 62 | contain|s a numb|
|00000ce0| 65 72 20 6f 66 20 69 6d | 70 6f 72 74 61 6e 74 20 |er of im|portant |
|00000cf0| 64 69 72 65 63 74 6f 72 | 69 65 73 2c 20 69 6e 63 |director|ies, inc|
|00000d00| 6c 75 64 69 6e 67 3a 0d | 0d 62 75 74 69 6c 20 c4 |luding:.|.butil .|
|00000d10| 0d 0d 09 54 68 69 73 20 | 64 69 72 65 63 74 6f 72 |...This |director|
|00000d20| 79 20 69 6e 63 6c 75 64 | 65 73 20 61 20 73 6d 61 |y includ|es a sma|
|00000d30| 6c 6c 20 6c 69 62 72 61 | 72 79 20 28 62 75 74 69 |ll libra|ry (buti|
|00000d40| 6c 2e 63 29 20 66 6f 72 | 20 73 75 70 70 6f 72 74 |l.c) for| support|
|00000d50| 69 6e 67 20 55 4e 49 58 | 20 62 69 6e 61 72 79 0d |ing UNIX| binary.|
|00000d60| 09 75 74 69 6c 69 74 69 | 65 73 2c 20 73 75 63 68 |.utiliti|es, such|
|00000d70| 20 61 73 20 62 63 6d 70 | 2c 20 62 63 6f 70 79 2c | as bcmp|, bcopy,|
|00000d80| 20 62 7a 65 72 6f 2c 20 | 61 6e 64 20 66 66 73 2e | bzero, |and ffs.|
|00000d90| 20 20 54 68 65 73 65 20 | 72 6f 75 74 69 6e 65 73 | These |routines|
|00000da0| 20 61 72 65 20 68 61 6e | 64 79 2c 0d 09 65 76 65 | are han|dy,..eve|
|00000db0| 6e 20 74 68 6f 75 67 68 | 20 74 68 65 79 20 61 72 |n though| they ar|
|00000dc0| 65 20 66 61 72 20 66 72 | 6f 6d 20 6f 70 74 69 6d |e far fr|om optim|
|00000dd0| 69 7a 65 64 2e 0d 09 0d | 69 70 20 c4 0d 0d 09 48 |ized....|ip ....H|
|00000de0| 65 72 65 20 6c 69 65 73 | 20 74 68 65 20 6e 65 74 |ere lies| the net|
|00000df0| 77 6f 72 6b 69 6e 67 20 | 63 6f 64 65 2e 20 20 54 |working |code. T|
|00000e00| 68 65 20 62 75 6c 6b 20 | 6f 66 20 74 68 65 20 63 |he bulk |of the c|
|00000e10| 6f 64 65 20 63 61 6e 20 | 62 65 20 66 6f 75 6e 64 |ode can |be found|
|00000e20| 20 69 6e 20 69 70 2e 63 | 2c 0d 09 74 68 65 20 61 | in ip.c|,..the a|
|00000e30| 70 70 6c 69 63 61 74 69 | 6f 6e 20 6c 65 76 65 6c |pplicati|on level|
|00000e40| 20 69 6e 74 65 72 66 61 | 63 65 2c 20 61 6e 64 20 | interfa|ce, and |
|00000e50| 69 70 6c 6f 77 2e 63 2c | 20 74 68 65 20 4d 61 63 |iplow.c,| the Mac|
|00000e60| 54 43 50 20 6c 65 76 65 | 6c 20 69 6e 74 65 72 66 |TCP leve|l interf|
|00000e70| 61 63 65 2e 20 54 68 65 | 0d 09 72 65 6d 61 69 6e |ace. The|..remain|
|00000e80| 69 6e 67 20 66 69 6c 65 | 73 20 28 69 70 64 72 2e |ing file|s (ipdr.|
|00000e90| 63 2c 20 69 70 65 72 72 | 2e 63 2c 20 69 70 74 69 |c, iperr|.c, ipti|
|00000ea0| 6d 65 2e 68 2c 20 65 74 | 63 2e 29 20 70 72 6f 76 |me.h, et|c.) prov|
|00000eb0| 69 64 65 20 6c 65 73 73 | 20 69 6d 70 6f 72 74 61 |ide less| importa|
|00000ec0| 6e 74 0d 09 66 65 61 74 | 75 72 65 73 2e 0d 0d 4d |nt..feat|ures...M|
|00000ed0| 61 63 54 43 50 20 48 65 | 61 64 65 72 73 20 c4 0d |acTCP He|aders ..|
|00000ee0| 09 0d 09 4d 61 63 54 43 | 50 20 68 65 61 64 65 72 |...MacTC|P header|
|00000ef0| 20 66 69 6c 65 73 20 66 | 6f 72 20 62 6f 74 68 20 | files f|or both |
|00000f00| 74 68 65 20 55 6e 69 76 | 65 72 73 61 6c 20 48 65 |the Univ|ersal He|
|00000f10| 61 64 65 72 73 20 61 6e | 64 20 66 6f 72 20 6f 6c |aders an|d for ol|
|00000f20| 64 65 72 20 70 72 65 2d | 55 48 20 0d 09 73 79 73 |der pre-|UH ..sys|
|00000f30| 74 65 6d 73 20 28 69 2e | 65 2e 2c 20 54 48 49 4e |tems (i.|e., THIN|
|00000f40| 4b 20 43 20 35 2e 30 2e | 34 29 2e 20 20 53 65 65 |K C 5.0.|4). See|
|00000f50| 20 74 68 65 20 d2 48 65 | 61 64 65 72 73 20 52 65 | the .He|aders Re|
|00000f60| 61 64 4d 65 d3 20 69 6e | 20 74 68 69 73 20 64 69 |adMe. in| this di|
|00000f70| 72 65 63 74 6f 72 79 0d | 09 66 6f 72 20 6d 6f 72 |rectory.|.for mor|
|00000f80| 65 20 69 6e 66 6f 72 6d | 61 74 69 6f 6e 2e 0d 0d |e inform|ation...|
|00000f90| 53 61 6d 70 6c 65 20 41 | 70 70 73 20 c4 0d 0d 09 |Sample A|pps ....|
|00000fa0| 41 20 70 61 69 72 20 6f | 66 20 73 61 6d 70 6c 65 |A pair o|f sample|
|00000fb0| 20 61 70 70 6c 69 63 61 | 74 69 6f 6e 73 20 68 61 | applica|tions ha|
|00000fc0| 76 65 20 62 65 65 6e 20 | 70 72 6f 76 69 64 65 64 |ve been |provided|
|00000fd0| 20 74 6f 20 64 65 6d 6f | 6e 73 74 72 61 74 65 20 | to demo|nstrate |
|00000fe0| 53 69 6d 70 6c 65 0d 09 | 53 6f 63 6b 65 74 73 20 |Simple..|Sockets |
|00000ff0| 69 6e 20 61 63 74 69 6f | 6e 2e 20 20 54 68 65 20 |in actio|n. The |
|00001000| 70 72 6f 67 72 61 6d 73 | 20 61 72 65 20 70 72 6f |programs| are pro|
|00001010| 62 61 62 6c 79 20 62 75 | 67 67 79 20 28 49 20 6b |bably bu|ggy (I k|
|00001020| 6e 6f 77 20 6f 66 20 6f | 6e 65 20 70 72 6f 62 6c |now of o|ne probl|
|00001030| 65 6d 0d 09 77 69 74 68 | 20 74 68 65 20 4d 61 63 |em..with| the Mac|
|00001040| 44 61 79 64 20 70 72 6f | 67 72 61 6d 20 66 6f 72 |Dayd pro|gram for|
|00001050| 20 73 75 72 65 29 2c 20 | 61 6e 64 20 64 6f 20 76 | sure), |and do v|
|00001060| 65 72 79 20 6c 69 74 74 | 6c 65 20 65 72 72 6f 72 |ery litt|le error|
|00001070| 20 72 65 70 6f 72 74 69 | 6e 67 2e 20 20 41 73 0d | reporti|ng. As.|
|00001080| 09 66 75 72 74 68 65 72 | 20 65 76 69 64 65 6e 63 |.further| evidenc|
|00001090| 65 20 74 68 61 74 20 49 | 20 68 61 63 6b 65 64 20 |e that I| hacked |
|000010a0| 74 68 65 6d 20 75 70 20 | 69 6e 20 61 6e 20 68 6f |them up |in an ho|
|000010b0| 75 72 2c 20 74 68 65 20 | 63 6f 64 65 20 69 73 20 |ur, the |code is |
|000010c0| 61 20 6c 69 74 74 6c 65 | 20 68 61 72 64 0d 09 74 |a little| hard..t|
|000010d0| 6f 20 72 65 61 64 20 69 | 6e 20 73 70 6f 74 73 2e |o read i|n spots.|
|000010e0| 20 20 53 74 69 6c 6c 2c | 20 74 68 65 79 20 73 68 | Still,| they sh|
|000010f0| 6f 75 6c 64 20 67 69 76 | 65 20 6f 6e 65 20 73 6f |ould giv|e one so|
|00001100| 6d 65 20 69 64 65 61 20 | 6f 66 20 68 6f 77 20 74 |me idea |of how t|
|00001110| 6f 20 75 73 65 20 74 68 | 65 0d 09 53 69 6d 70 6c |o use th|e..Simpl|
|00001120| 65 20 53 6f 63 6b 65 74 | 73 20 6c 69 62 72 61 72 |e Socket|s librar|
|00001130| 79 2e 0d 09 0d 09 54 68 | 65 20 73 61 6d 70 6c 65 |y.....Th|e sample|
|00001140| 20 70 72 6f 67 72 61 6d | 73 2c 20 4d 61 63 44 61 | program|s, MacDa|
|00001150| 79 20 61 6e 64 20 4d 61 | 63 44 61 79 64 2c 20 61 |y and Ma|cDayd, a|
|00001160| 72 65 20 6d 6f 64 65 6c | 65 64 20 61 66 74 65 72 |re model|ed after|
|00001170| 20 73 6f 6d 65 20 65 78 | 61 6d 70 6c 65 73 20 69 | some ex|amples i|
|00001180| 6e 0d 09 43 6f 6d 65 72 | 27 73 20 49 6e 74 65 72 |n..Comer|'s Inter|
|00001190| 6e 65 74 77 6f 72 6b 69 | 6e 67 20 77 69 74 68 20 |networki|ng with |
|000011a0| 54 43 50 2f 49 50 20 76 | 6f 6c 20 49 49 49 2e 20 |TCP/IP v|ol III. |
|000011b0| 20 49 74 20 73 65 65 6d | 73 20 74 68 61 74 20 62 | It seem|s that b|
|000011c0| 79 20 70 69 6e 67 69 6e | 67 20 70 6f 72 74 0d 09 |y pingin|g port..|
|000011d0| 31 33 20 6f 66 20 61 6e | 79 20 55 4e 49 58 20 6d |13 of an|y UNIX m|
|000011e0| 61 63 68 69 6e 65 2c 20 | 74 68 61 74 20 6d 61 63 |achine, |that mac|
|000011f0| 68 69 6e 65 20 77 69 6c | 6c 20 74 65 6c 6c 20 79 |hine wil|l tell y|
|00001200| 6f 75 20 77 68 61 74 20 | 74 69 6d 65 20 69 74 20 |ou what |time it |
|00001210| 74 68 69 6e 6b 73 20 69 | 74 20 69 73 2e 0d 09 4d |thinks i|t is...M|
|00001220| 61 63 44 61 79 20 69 73 | 20 61 20 63 6c 69 65 6e |acDay is| a clien|
|00001230| 74 20 70 72 6f 67 72 61 | 6d 20 66 6f 72 20 74 68 |t progra|m for th|
|00001240| 65 20 44 41 59 54 49 4d | 45 20 73 65 72 76 69 63 |e DAYTIM|E servic|
|00001250| 65 2c 20 77 68 69 6c 65 | 20 4d 61 63 44 61 79 64 |e, while| MacDayd|
|00001260| 20 69 73 20 61 20 73 69 | 6d 70 6c 65 0d 09 73 65 | is a si|mple..se|
|00001270| 72 76 65 72 20 74 6f 20 | 61 6c 6c 6f 77 20 6f 6e |rver to |allow on|
|00001280| 65 27 73 20 4d 61 63 69 | 6e 74 6f 73 68 20 74 6f |e's Maci|ntosh to|
|00001290| 20 61 63 63 65 70 74 20 | 44 41 59 54 49 4d 45 20 | accept |DAYTIME |
|000012a0| 71 75 65 72 69 65 73 2e | 20 20 54 68 65 73 65 20 |queries.| These |
|000012b0| 70 72 6f 67 72 61 6d 73 | 0d 09 61 72 65 20 6d 75 |programs|..are mu|
|000012c0| 63 68 20 6c 65 73 73 20 | 69 6e 74 65 72 65 73 74 |ch less |interest|
|000012d0| 69 6e 67 20 74 68 61 6e | 20 61 6e 79 20 50 65 74 |ing than| any Pet|
|000012e0| 65 72 20 4e 2e 20 4c 65 | 77 69 73 20 70 72 6f 67 |er N. Le|wis prog|
|000012f0| 72 61 6d 2e 0d 09 0d 0d | 33 2e 20 49 6e 73 74 61 |ram.....|3. Insta|
|00001300| 6c 6c 61 74 69 6f 6e 0d | 7e 7e 7e 7e 7e 7e 7e 7e |llation.|~~~~~~~~|
|00001310| 7e 7e 7e 7e 7e 7e 7e 0d | 0d 50 72 6f 6a 65 63 74 |~~~~~~~.|.Project|
|00001320| 73 20 74 68 61 74 20 75 | 73 65 20 53 69 6d 70 6c |s that u|se Simpl|
|00001330| 65 20 53 6f 63 6b 65 74 | 73 20 6e 65 65 64 20 74 |e Socket|s need t|
|00001340| 6f 20 68 61 76 65 20 61 | 63 63 65 73 73 20 74 6f |o have a|ccess to|
|00001350| 20 74 68 65 20 62 75 74 | 69 6c 20 c4 20 61 6e 64 | the but|il . and|
|00001360| 20 69 70 20 c4 0d 64 69 | 72 65 63 74 6f 72 69 65 | ip ..di|rectorie|
|00001370| 73 2c 20 61 73 20 77 65 | 6c 6c 20 61 73 20 74 68 |s, as we|ll as th|
|00001380| 65 20 68 65 61 64 65 72 | 73 20 66 6f 72 20 4d 61 |e header|s for Ma|
|00001390| 63 54 43 50 2e 20 20 50 | 6c 65 61 73 65 20 72 65 |cTCP. P|lease re|
|000013a0| 66 65 72 20 74 6f 20 79 | 6f 75 72 20 63 6f 6d 70 |fer to y|our comp|
|000013b0| 69 6c 65 72 0d 64 6f 63 | 75 6d 65 6e 74 61 74 69 |iler.doc|umentati|
|000013c0| 6f 6e 20 66 6f 72 20 69 | 6e 66 6f 72 6d 61 74 69 |on for i|nformati|
|000013d0| 6f 6e 20 6f 6e 20 68 6f | 77 20 74 6f 20 64 6f 20 |on on ho|w to do |
|000013e0| 74 68 69 73 2e 20 20 57 | 69 74 68 20 4d 65 74 72 |this. W|ith Metr|
|000013f0| 6f 77 65 72 6b 73 20 43 | 6f 64 65 57 61 72 72 69 |owerks C|odeWarri|
|00001400| 6f 72 2c 0d 74 68 72 65 | 65 20 64 69 66 66 65 72 |or,.thre|e differ|
|00001410| 65 6e 74 20 73 74 72 61 | 74 65 67 69 65 73 20 6c |ent stra|tegies l|
|00001420| 65 61 70 20 74 6f 20 6d | 79 20 6d 69 6e 64 3a 0d |eap to m|y mind:.|
|00001430| 0d 09 31 29 20 47 6f 20 | 69 6e 74 6f 20 79 6f 75 |..1) Go |into you|
|00001440| 72 20 70 72 6f 6a 65 63 | 74 27 73 20 70 72 65 66 |r projec|t's pref|
|00001450| 65 72 65 6e 63 65 73 20 | 61 6e 64 20 73 65 74 20 |erences |and set |
|00001460| 74 68 65 20 70 72 6f 6a | 65 63 74 27 73 20 41 63 |the proj|ect's Ac|
|00001470| 63 65 73 73 20 50 61 74 | 68 20 74 6f 0d 09 69 6e |cess Pat|h to..in|
|00001480| 63 6c 75 64 65 20 62 6f | 74 68 20 64 69 72 65 63 |clude bo|th direc|
|00001490| 74 6f 72 69 65 73 2e 20 | 20 57 68 69 6c 65 20 74 |tories. | While t|
|000014a0| 68 69 73 20 77 6f 72 6b | 73 2c 20 69 74 27 73 20 |his work|s, it's |
|000014b0| 61 20 6c 69 74 74 6c 65 | 20 74 65 64 69 6f 75 73 |a little| tedious|
|000014c0| 20 74 6f 20 64 6f 0d 09 | 6f 6e 63 65 2c 20 6e 65 | to do..|once, ne|
|000014d0| 76 65 72 20 6d 69 6e 64 | 20 6d 6f 72 65 20 73 65 |ver mind| more se|
|000014e0| 76 65 72 61 6c 20 70 72 | 6f 6a 65 63 74 73 2e 0d |veral pr|ojects..|
|000014f0| 0d 09 32 29 20 43 6f 70 | 79 20 74 68 65 20 64 69 |..2) Cop|y the di|
|00001500| 72 65 63 74 6f 72 69 65 | 73 20 69 6e 74 6f 20 74 |rectorie|s into t|
|00001510| 68 65 20 61 70 70 6c 69 | 63 61 74 69 6f 6e 27 73 |he appli|cation's|
|00001520| 20 70 72 6f 6a 65 63 74 | 20 64 69 72 65 63 74 6f | project| directo|
|00001530| 72 79 2e 20 20 4f 66 20 | 63 6f 75 72 73 65 2c 0d |ry. Of |course,.|
|00001540| 09 69 66 20 79 6f 75 20 | 61 72 65 20 70 6c 61 6e |.if you |are plan|
|00001550| 6e 69 6e 67 20 6f 6e 20 | 77 72 69 74 69 6e 67 20 |ning on |writing |
|00001560| 6c 6f 74 73 20 6f 66 20 | 64 69 66 66 65 72 65 6e |lots of |differen|
|00001570| 74 20 53 69 6d 70 6c 65 | 20 53 6f 63 6b 65 74 73 |t Simple| Sockets|
|00001580| 20 61 70 70 73 2c 20 79 | 6f 75 27 6c 6c 0d 09 62 | apps, y|ou'll..b|
|00001590| 65 20 64 6f 69 6e 67 20 | 61 20 6c 6f 74 20 6f 66 |e doing |a lot of|
|000015a0| 20 63 6f 70 79 69 6e 67 | 2e 0d 0d 09 33 29 20 4d | copying|....3) M|
|000015b0| 6f 76 65 20 74 68 65 20 | 64 69 72 65 63 74 6f 72 |ove the |director|
|000015c0| 69 65 73 20 69 6e 74 6f | 20 74 68 65 20 73 61 6d |ies into| the sam|
|000015d0| 65 20 66 6f 6c 64 65 72 | 20 61 73 20 79 6f 75 72 |e folder| as your|
|000015e0| 20 4d 65 74 72 6f 77 65 | 72 6b 73 20 63 6f 6d 70 | Metrowe|rks comp|
|000015f0| 69 6c 65 72 2e 20 20 49 | 0d 09 61 6d 20 70 65 72 |iler. I|..am per|
|00001600| 73 6f 6e 61 6c 6c 79 20 | 71 75 69 74 65 20 66 6f |sonally |quite fo|
|00001610| 6e 64 20 6f 66 20 74 68 | 69 73 20 73 6f 6c 75 74 |nd of th|is solut|
|00001620| 69 6f 6e 2c 20 70 65 72 | 73 6f 6e 61 6c 6c 79 2e |ion, per|sonally.|
|00001630| 0d 0d 49 20 62 65 6c 69 | 65 76 65 20 74 68 65 73 |..I beli|eve thes|
|00001640| 65 20 73 74 72 61 74 65 | 67 69 65 73 20 77 69 6c |e strate|gies wil|
|00001650| 6c 20 61 6c 73 6f 20 77 | 6f 72 6b 20 77 69 74 68 |l also w|ork with|
|00001660| 20 74 68 65 20 54 48 49 | 4e 4b 20 63 6f 6d 70 69 | the THI|NK compi|
|00001670| 6c 65 72 73 2e 0d 0d 4e | 6f 74 65 3a 20 20 53 69 |lers...N|ote: Si|
|00001680| 6d 70 6c 65 20 53 6f 63 | 6b 65 74 73 20 65 78 70 |mple Soc|kets exp|
|00001690| 65 63 74 73 20 61 6e 64 | 20 64 65 6d 61 6e 64 73 |ects and| demands|
|000016a0| 20 41 70 70 6c 65 27 73 | 20 55 6e 69 76 65 72 73 | Apple's| Univers|
|000016b0| 61 6c 20 48 65 61 64 65 | 72 73 2e 20 20 49 66 20 |al Heade|rs. If |
|000016c0| 79 6f 75 20 61 72 65 0d | 75 73 69 6e 67 20 61 6e |you are.|using an|
|000016d0| 20 6f 6c 64 20 76 65 72 | 73 69 6f 6e 20 6f 66 20 | old ver|sion of |
|000016e0| 54 48 49 4e 4b 20 43 2c | 20 74 68 65 6e 20 79 6f |THINK C,| then yo|
|000016f0| 75 20 77 69 6c 6c 20 6e | 65 65 64 20 74 6f 20 6d |u will n|eed to m|
|00001700| 6f 64 69 66 79 20 74 68 | 65 20 73 6f 75 72 63 65 |odify th|e source|
|00001710| 20 61 20 62 69 74 2e 0d | 49 66 20 49 20 67 65 74 | a bit..|If I get|
|00001720| 20 61 20 63 68 61 6e 63 | 65 2c 20 49 27 6c 6c 20 | a chanc|e, I'll |
|00001730| 23 69 66 64 65 66 20 53 | 69 6d 70 6c 65 20 53 6f |#ifdef S|imple So|
|00001740| 63 6b 65 74 73 20 66 6f | 72 20 6f 6c 64 65 72 20 |ckets fo|r older |
|00001750| 54 48 49 4e 4b 20 43 20 | 63 6f 6d 70 61 74 69 62 |THINK C |compatib|
|00001760| 69 6c 69 74 79 2e 0d 0d | 0d 34 2e 20 55 73 69 6e |ility...|.4. Usin|
|00001770| 67 20 53 69 6d 70 6c 65 | 20 53 6f 63 6b 65 74 73 |g Simple| Sockets|
|00001780| 0d 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |.~~~~~~~|~~~~~~~~|
|00001790| 7e 7e 7e 7e 7e 7e 7e 7e | 0d 0d 55 73 69 6e 67 20 |~~~~~~~~|..Using |
|000017a0| 53 69 6d 70 6c 65 20 53 | 6f 63 6b 65 74 73 20 69 |Simple S|ockets i|
|000017b0| 73 20 72 65 6c 61 74 69 | 76 65 6c 79 20 65 61 73 |s relati|vely eas|
|000017c0| 79 2c 20 65 73 70 65 63 | 69 61 6c 6c 79 20 66 6f |y, espec|ially fo|
|000017d0| 72 20 74 68 6f 73 65 20 | 70 72 6f 67 72 61 6d 6d |r those |programm|
|000017e0| 65 72 73 20 77 69 74 68 | 0d 55 4e 49 58 20 73 6f |ers with|.UNIX so|
|000017f0| 63 6b 65 74 20 70 72 6f | 67 72 61 6d 6d 69 6e 67 |cket pro|gramming|
|00001800| 20 65 78 70 65 72 69 65 | 6e 63 65 2e 20 20 41 73 | experie|nce. As|
|00001810| 20 49 20 68 61 76 65 20 | 61 6c 6c 75 64 65 64 20 | I have |alluded |
|00001820| 74 6f 20 61 6c 72 65 61 | 64 79 2c 20 73 6f 6d 65 |to alrea|dy, some|
|00001830| 20 20 53 69 6d 70 6c 65 | 0d 53 6f 63 6b 65 74 20 | Simple|.Socket |
|00001840| 72 6f 75 74 69 6e 65 73 | 20 61 72 65 20 73 69 6d |routines| are sim|
|00001850| 69 6c 61 72 20 74 6f 2c | 20 62 75 74 20 6e 6f 74 |ilar to,| but not|
|00001860| 20 69 64 65 6e 74 69 63 | 61 6c 20 74 6f 2c 20 74 | identic|al to, t|
|00001870| 68 65 69 72 20 55 4e 49 | 58 20 63 6f 75 6e 74 65 |heir UNI|X counte|
|00001880| 72 70 61 72 74 73 2e 0d | 54 68 65 73 65 20 64 69 |rparts..|These di|
|00001890| 66 66 65 72 65 6e 63 65 | 73 20 77 69 6c 6c 20 62 |fference|s will b|
|000018a0| 65 20 65 78 70 6c 61 69 | 6e 65 64 20 6c 61 74 65 |e explai|ned late|
|000018b0| 72 20 69 6e 20 74 68 69 | 73 20 64 6f 63 75 6d 65 |r in thi|s docume|
|000018c0| 6e 74 2e 0d 0d 54 68 65 | 20 66 6f 6c 6c 6f 77 69 |nt...The| followi|
|000018d0| 6e 67 20 66 69 6c 65 73 | 20 6d 75 73 74 20 62 65 |ng files| must be|
|000018e0| 20 61 64 64 65 64 20 74 | 6f 20 6f 6e 65 27 73 20 | added t|o one's |
|000018f0| 70 72 6f 6a 65 63 74 3a | 20 62 75 74 69 6c 2e 63 |project:| butil.c|
|00001900| 2c 20 69 70 2e 63 2c 20 | 69 70 65 72 72 2e 63 2c |, ip.c, |iperr.c,|
|00001910| 20 61 6e 64 0d 69 70 6c | 6f 77 2e 63 2e 20 20 69 | and.ipl|ow.c. i|
|00001920| 70 64 72 2e 63 20 69 73 | 20 6f 70 74 69 6f 6e 61 |pdr.c is| optiona|
|00001930| 6c 2c 20 61 6e 64 20 69 | 73 20 70 72 6f 62 61 62 |l, and i|s probab|
|00001940| 6c 79 20 6f 6e 6c 79 20 | 6e 65 63 65 73 73 61 72 |ly only |necessar|
|00001950| 79 20 69 66 20 79 6f 75 | 20 61 72 65 20 70 6f 72 |y if you| are por|
|00001960| 74 69 6e 67 0d 73 6f 6d | 65 20 65 78 69 73 74 69 |ting.som|e existi|
|00001970| 6e 67 20 55 4e 49 58 20 | 63 6f 64 65 20 74 6f 20 |ng UNIX |code to |
|00001980| 74 68 65 20 4d 61 63 69 | 6e 74 6f 73 68 2e 0d 0d |the Maci|ntosh...|
|00001990| 54 68 65 20 66 69 6c 65 | 20 4d 61 63 54 43 50 43 |The file| MacTCPC|
|000019a0| 6f 6d 6d 6f 6e 54 79 70 | 65 73 2e 68 20 6d 75 73 |ommonTyp|es.h mus|
|000019b0| 74 20 62 65 20 23 69 6e | 63 6c 75 64 65 64 20 62 |t be #in|cluded b|
|000019c0| 65 66 6f 72 65 20 61 6e | 79 20 69 70 20 66 69 6c |efore an|y ip fil|
|000019d0| 65 73 20 61 72 65 2e 20 | 20 46 6f 72 0d 62 61 73 |es are. | For.bas|
|000019e0| 69 63 20 73 6f 63 6b 65 | 74 20 73 75 70 70 6f 72 |ic socke|t suppor|
|000019f0| 74 2c 20 6f 6e 65 20 77 | 6f 75 6c 64 20 69 6e 63 |t, one w|ould inc|
|00001a00| 6c 75 64 65 3a 0d 0d 09 | 20 23 69 6e 63 6c 75 64 |lude:...| #includ|
|00001a10| 65 20 3c 4d 61 63 54 43 | 50 43 6f 6d 6d 6f 6e 54 |e <MacTC|PCommonT|
|00001a20| 79 70 65 73 2e 68 3e 0d | 09 20 0d 09 20 23 69 6e |ypes.h>.|. .. #in|
|00001a30| 63 6c 75 64 65 20 22 69 | 70 2e 68 22 0d 09 20 23 |clude "i|p.h".. #|
|00001a40| 69 6e 63 6c 75 64 65 20 | 22 69 70 65 72 72 2e 68 |include |"iperr.h|
|00001a50| 22 0d 20 0d 54 68 65 20 | 53 69 6d 70 6c 65 20 53 |". .The |Simple S|
|00001a60| 6f 63 6b 65 74 73 20 6c | 69 62 72 61 72 79 20 6d |ockets l|ibrary m|
|00001a70| 75 73 74 20 62 65 20 69 | 6e 69 74 69 61 6c 69 7a |ust be i|nitializ|
|00001a80| 65 64 20 61 74 20 72 75 | 6e 20 74 69 6d 65 20 62 |ed at ru|n time b|
|00001a90| 65 66 6f 72 65 20 61 6e | 79 20 73 6f 63 6b 65 74 |efore an|y socket|
|00001aa0| 0d 72 6f 75 74 69 6e 65 | 73 20 61 72 65 20 63 61 |.routine|s are ca|
|00001ab0| 6c 6c 65 64 2e 20 20 54 | 68 65 20 72 6f 75 74 69 |lled. T|he routi|
|00001ac0| 6e 65 20 22 49 6e 69 74 | 4d 61 63 54 43 50 22 20 |ne "Init|MacTCP" |
|00001ad0| 6f 70 65 6e 73 20 74 68 | 65 20 4d 61 63 54 43 50 |opens th|e MacTCP|
|00001ae0| 20 64 72 69 76 65 72 20 | 61 6e 64 0d 70 65 72 66 | driver |and.perf|
|00001af0| 6f 72 6d 73 20 73 6f 6d | 65 20 61 64 64 69 74 69 |orms som|e additi|
|00001b00| 6f 6e 61 6c 20 68 6f 75 | 73 65 2d 6b 65 65 70 69 |onal hou|se-keepi|
|00001b10| 6e 67 2e 20 20 49 74 20 | 73 68 6f 75 6c 64 6e 27 |ng. It |shouldn'|
|00001b20| 74 20 68 75 72 74 20 74 | 6f 20 70 6c 61 63 65 20 |t hurt t|o place |
|00001b30| 49 6e 69 74 4d 61 63 54 | 43 50 20 69 6e 0d 79 6f |InitMacT|CP in.yo|
|00001b40| 75 72 20 54 6f 6f 6c 42 | 6f 78 49 6e 69 74 20 28 |ur ToolB|oxInit (|
|00001b50| 6f 72 20 77 68 61 74 65 | 76 65 72 29 20 70 72 6f |or whate|ver) pro|
|00001b60| 63 65 64 75 72 65 2e 0d | 0d 42 65 66 6f 72 65 20 |cedure..|.Before |
|00001b70| 74 68 65 20 70 72 6f 67 | 72 61 6d 20 74 65 72 6d |the prog|ram term|
|00001b80| 69 6e 61 74 65 73 2c 20 | 69 74 20 6d 75 73 74 20 |inates, |it must |
|00001b90| 6d 61 6b 65 20 73 75 72 | 65 20 74 68 61 74 20 61 |make sur|e that a|
|00001ba0| 6c 6c 20 61 63 74 69 76 | 65 20 73 6f 63 6b 65 74 |ll activ|e socket|
|00001bb0| 73 20 61 72 65 0d 63 6c | 6f 73 65 64 2e 20 49 66 |s are.cl|osed. If|
|00001bc0| 20 61 20 70 72 6f 67 72 | 61 6d 20 71 75 69 74 73 | a progr|am quits|
|00001bd0| 20 77 69 74 68 6f 75 74 | 20 6c 65 74 74 69 6e 67 | without| letting|
|00001be0| 20 4d 61 63 54 43 50 20 | 6b 6e 6f 77 20 61 20 73 | MacTCP |know a s|
|00001bf0| 74 72 65 61 6d 20 69 73 | 20 66 72 65 65 2c 20 4d |tream is| free, M|
|00001c00| 61 63 54 43 50 0d 63 61 | 6e 20 28 61 6e 64 20 77 |acTCP.ca|n (and w|
|00001c10| 69 6c 6c 21 29 20 63 72 | 61 73 68 20 74 68 65 20 |ill!) cr|ash the |
|00001c20| 65 6e 74 69 72 65 20 6d | 61 63 68 69 6e 65 20 69 |entire m|achine i|
|00001c30| 6e 20 61 20 62 6c 61 7a | 65 20 6f 66 20 67 6c 6f |n a blaz|e of glo|
|00001c40| 72 79 20 28 69 66 20 79 | 6f 75 20 64 6f 6e 27 74 |ry (if y|ou don't|
|00001c50| 0d 62 65 6c 69 65 76 65 | 20 6d 65 2c 20 66 6f 72 |.believe| me, for|
|00001c60| 63 65 20 71 75 69 74 20 | 4e 43 53 41 20 54 65 6c |ce quit |NCSA Tel|
|00001c70| 6e 65 74 20 61 20 66 65 | 77 20 74 69 6d 65 73 29 |net a fe|w times)|
|00001c80| 2e 20 20 54 6f 20 62 65 | 20 73 61 66 65 2c 20 79 |. To be| safe, y|
|00001c90| 6f 75 20 63 61 6e 20 63 | 61 6c 6c 0d 22 44 69 73 |ou can c|all."Dis|
|00001ca0| 70 6f 73 65 4d 61 63 54 | 43 50 22 20 62 65 66 6f |poseMacT|CP" befo|
|00001cb0| 72 65 20 71 75 69 74 74 | 69 6e 67 3b 20 44 69 73 |re quitt|ing; Dis|
|00001cc0| 70 6f 73 65 4d 61 63 54 | 43 50 20 77 69 6c 6c 20 |poseMacT|CP will |
|00001cd0| 63 6c 6f 73 65 20 61 6c | 6c 20 72 65 6d 61 69 6e |close al|l remain|
|00001ce0| 69 6e 67 20 73 74 72 65 | 61 6d 73 0d 66 6f 72 20 |ing stre|ams.for |
|00001cf0| 79 6f 75 2e 20 20 28 54 | 69 70 3a 20 4d 61 6b 65 |you. (T|ip: Make|
|00001d00| 20 73 75 72 65 20 79 6f | 75 20 63 61 6c 6c 20 74 | sure yo|u call t|
|00001d10| 68 69 73 20 61 74 20 74 | 68 65 20 65 6e 64 20 6f |his at t|he end o|
|00001d20| 66 20 74 68 65 20 70 72 | 6f 67 72 61 6d 2c 20 61 |f the pr|ogram, a|
|00001d30| 6e 64 20 62 65 66 6f 72 | 65 20 61 6e 79 0d 22 45 |nd befor|e any."E|
|00001d40| 78 69 74 54 6f 53 68 65 | 6c 6c 22 20 63 61 6c 6c |xitToShe|ll" call|
|00001d50| 73 21 29 0d 0d 41 6c 6c | 20 73 6f 63 6b 65 74 20 |s!)..All| socket |
|00001d60| 63 61 6c 6c 73 20 61 72 | 65 20 61 73 79 6e 63 68 |calls ar|e asynch|
|00001d70| 72 6f 6e 6f 75 73 2e 20 | 20 57 68 69 6c 65 20 61 |ronous. | While a|
|00001d80| 20 70 72 6f 67 72 61 6d | 20 69 73 20 77 61 69 74 | program| is wait|
|00001d90| 69 6e 67 20 66 6f 72 20 | 73 6f 6d 65 20 6e 65 74 |ing for |some net|
|00001da0| 77 6f 72 6b 0d 74 72 61 | 6e 73 61 63 74 69 6f 6e |work.tra|nsaction|
|00001db0| 20 74 6f 20 74 61 6b 65 | 20 70 6c 61 63 65 2c 20 | to take| place, |
|00001dc0| 74 68 65 20 63 6f 6d 70 | 75 74 65 72 20 63 6f 6e |the comp|uter con|
|00001dd0| 74 69 6e 75 65 73 20 6d | 75 6c 74 69 2d 74 61 73 |tinues m|ulti-tas|
|00001de0| 6b 69 6e 67 20 61 77 61 | 79 2e 20 20 54 68 69 73 |king awa|y. This|
|00001df0| 20 69 73 0d 70 72 6f 76 | 69 64 65 64 20 69 6e 20 | is.prov|ided in |
|00001e00| 70 61 72 74 20 62 79 20 | 61 20 73 65 63 6f 6e 64 |part by |a second|
|00001e10| 61 72 79 20 65 76 65 6e | 74 20 6c 6f 6f 70 20 28 |ary even|t loop (|
|00001e20| 63 61 6c 6c 65 64 20 61 | 20 22 53 70 69 6e 20 52 |called a| "Spin R|
|00001e30| 6f 75 74 69 6e 65 22 29 | 2c 20 77 68 69 63 68 20 |outine")|, which |
|00001e40| 63 61 6c 6c 73 0d 57 61 | 69 74 4e 65 78 74 45 76 |calls.Wa|itNextEv|
|00001e50| 65 6e 74 20 61 6e 64 20 | 70 72 6f 76 69 64 65 73 |ent and |provides|
|00001e60| 20 62 61 73 69 63 20 65 | 76 65 6e 74 20 70 72 6f | basic e|vent pro|
|00001e70| 63 65 73 73 69 6e 67 2e | 20 20 49 6e 20 6f 72 64 |cessing.| In ord|
|00001e80| 65 72 20 74 6f 20 70 72 | 6f 76 69 64 65 20 73 70 |er to pr|ovide sp|
|00001e90| 69 6e 6e 69 6e 67 0d 63 | 75 72 73 6f 72 73 20 6f |inning.c|ursors o|
|00001ea0| 72 20 44 69 61 6c 6f 67 | 73 20 77 69 74 68 20 22 |r Dialog|s with "|
|00001eb0| 43 61 6e 63 65 6c 22 20 | 62 75 74 74 6f 6e 73 2c |Cancel" |buttons,|
|00001ec0| 20 79 6f 75 20 6d 75 73 | 74 20 64 65 66 69 6e 65 | you mus|t define|
|00001ed0| 20 79 6f 75 72 20 6f 77 | 6e 20 53 70 69 6e 20 52 | your ow|n Spin R|
|00001ee0| 6f 75 74 69 6e 65 3b 0d | 73 65 65 20 22 4d 61 6b |outine;.|see "Mak|
|00001ef0| 69 6e 67 20 59 6f 75 72 | 20 4f 77 6e 20 53 70 69 |ing Your| Own Spi|
|00001f00| 6e 20 52 6f 75 74 69 6e | 65 73 22 20 62 65 6c 6f |n Routin|es" belo|
|00001f10| 77 20 66 6f 72 20 6d 6f | 72 65 20 69 6e 66 6f 72 |w for mo|re infor|
|00001f20| 6d 61 74 69 6f 6e 2e 0d | 0d 0d 35 2e 20 53 69 6d |mation..|..5. Sim|
|00001f30| 70 6c 65 20 53 6f 63 6b | 65 74 20 52 6f 75 74 69 |ple Sock|et Routi|
|00001f40| 6e 65 73 0d 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |nes.~~~~|~~~~~~~~|
|00001f50| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 0d 0d 41 |~~~~~~~~|~~~~~..A|
|00001f60| 74 20 74 68 69 73 20 74 | 69 6d 65 2c 20 6f 6e 6c |t this t|ime, onl|
|00001f70| 79 20 74 68 65 20 72 6f | 75 74 69 6e 65 73 20 69 |y the ro|utines i|
|00001f80| 6e 20 69 70 2e 63 20 61 | 6e 64 20 69 70 64 72 2e |n ip.c a|nd ipdr.|
|00001f90| 63 20 61 72 65 20 64 6f | 63 75 6d 65 6e 74 65 64 |c are do|cumented|
|00001fa0| 20 69 6e 20 74 68 69 73 | 20 6d 61 6e 75 61 6c 2e | in this| manual.|
|00001fb0| 0d 52 6f 75 74 69 6e 65 | 73 20 69 6e 20 6f 74 68 |.Routine|s in oth|
|00001fc0| 65 72 20 66 69 6c 65 73 | 20 61 72 65 20 65 69 74 |er files| are eit|
|00001fd0| 68 65 72 20 66 61 69 72 | 6c 79 20 73 74 72 61 69 |her fair|ly strai|
|00001fe0| 67 68 74 20 66 6f 72 77 | 61 72 64 20 28 49 4d 48 |ght forw|ard (IMH|
|00001ff0| 4f 29 20 6f 72 20 74 68 | 65 79 0d 73 68 6f 75 6c |O) or th|ey.shoul|
|00002000| 64 6e 27 74 20 62 65 20 | 6f 66 20 6d 75 63 68 20 |dn't be |of much |
|00002010| 75 73 65 20 74 6f 20 6f | 74 68 65 72 20 70 65 6f |use to o|ther peo|
|00002020| 70 6c 65 20 28 65 2e 67 | 2e 2c 20 69 70 6c 6f 77 |ple (e.g|., iplow|
|00002030| 2e 63 29 2e 20 20 4f 74 | 68 65 72 20 66 69 6c 65 |.c). Ot|her file|
|00002040| 73 20 6d 61 79 20 62 65 | 0d 64 6f 63 75 6d 65 6e |s may be|.documen|
|00002050| 74 65 64 20 68 65 72 65 | 20 69 6e 20 74 68 65 20 |ted here| in the |
|00002060| 66 75 74 75 72 65 2e 0d | 0d 0d 47 45 4e 45 52 41 |future..|..GENERA|
|00002070| 4c 20 52 4f 55 54 49 4e | 45 53 0d 0d 0d 49 6e 69 |L ROUTIN|ES...Ini|
|00002080| 74 4d 61 63 54 43 50 0d | 0d 09 4f 53 45 72 72 20 |tMacTCP.|..OSErr |
|00002090| 49 6e 69 74 4d 61 63 54 | 43 50 28 76 6f 69 64 29 |InitMacT|CP(void)|
|000020a0| 0d 0d 49 6e 69 74 4d 61 | 63 54 43 50 20 6d 75 73 |..InitMa|cTCP mus|
|000020b0| 74 20 62 65 20 63 61 6c | 6c 65 64 20 62 79 20 74 |t be cal|led by t|
|000020c0| 68 65 20 61 70 70 6c 69 | 63 61 74 69 6f 6e 20 62 |he appli|cation b|
|000020d0| 65 66 6f 72 65 20 6d 61 | 6b 69 6e 67 20 6f 74 68 |efore ma|king oth|
|000020e0| 65 72 20 63 61 6c 6c 73 | 20 74 6f 0d 72 6f 75 74 |er calls| to.rout|
|000020f0| 69 6e 65 73 20 69 6e 20 | 74 68 65 20 53 69 6d 70 |ines in |the Simp|
|00002100| 6c 65 20 53 6f 63 6b 65 | 74 73 20 6c 69 62 72 61 |le Socke|ts libra|
|00002110| 72 79 2e 20 20 49 74 20 | 69 6e 69 74 69 61 6c 69 |ry. It |initiali|
|00002120| 7a 65 73 20 74 68 65 20 | 4d 61 63 54 43 50 20 64 |zes the |MacTCP d|
|00002130| 72 69 76 65 72 2c 20 63 | 6c 65 61 72 73 0d 74 68 |river, c|lears.th|
|00002140| 65 20 73 6f 63 6b 65 74 | 20 6c 69 73 74 2c 20 61 |e socket| list, a|
|00002150| 6e 64 20 73 65 74 73 20 | 74 68 65 20 64 65 66 61 |nd sets |the defa|
|00002160| 75 6c 74 20 73 70 69 6e | 20 72 6f 75 74 69 6e 65 |ult spin| routine|
|00002170| 2e 0d 0d 0d 44 69 73 70 | 6f 73 65 4d 61 63 54 43 |....Disp|oseMacTC|
|00002180| 50 0d 0d 09 76 6f 69 64 | 20 44 69 73 70 6f 73 65 |P...void| Dispose|
|00002190| 4d 61 63 54 43 50 28 76 | 6f 69 64 29 0d 0d 44 69 |MacTCP(v|oid)..Di|
|000021a0| 73 70 6f 73 65 4d 61 63 | 54 43 50 20 73 68 6f 75 |sposeMac|TCP shou|
|000021b0| 6c 64 20 62 65 20 63 61 | 6c 6c 65 64 20 62 65 66 |ld be ca|lled bef|
|000021c0| 6f 72 65 20 61 6e 20 61 | 70 70 6c 69 63 61 74 69 |ore an a|pplicati|
|000021d0| 6f 6e 20 74 65 72 6d 69 | 6e 61 74 65 73 2c 20 6f |on termi|nates, o|
|000021e0| 72 20 77 68 65 6e 20 69 | 74 20 69 73 0d 64 6f 6e |r when i|t is.don|
|000021f0| 65 20 77 69 74 68 20 74 | 68 65 20 4d 61 63 54 43 |e with t|he MacTC|
|00002200| 50 20 64 72 69 76 65 72 | 2e 20 20 44 69 73 70 6f |P driver|. Dispo|
|00002210| 73 65 4d 61 63 54 43 50 | 20 63 6c 6f 73 65 73 20 |seMacTCP| closes |
|00002220| 61 6c 6c 20 69 6e 69 74 | 69 61 6c 69 7a 65 64 20 |all init|ialized |
|00002230| 73 6f 63 6b 65 74 73 2c | 20 61 6e 64 0d 64 69 73 |sockets,| and.dis|
|00002240| 70 6f 73 65 73 20 73 6f | 63 6b 65 74 73 27 20 62 |poses so|ckets' b|
|00002250| 75 66 66 65 72 20 6d 65 | 6d 6f 72 79 2e 0d 0d 0d |uffer me|mory....|
|00002260| 53 65 74 53 70 69 6e 0d | 0d 09 76 6f 69 64 20 53 |SetSpin.|..void S|
|00002270| 65 74 53 70 69 6e 28 53 | 70 69 6e 20 73 70 69 6e |etSpin(S|pin spin|
|00002280| 52 6f 75 74 69 6e 65 29 | 0d 0d 53 65 74 53 70 69 |Routine)|..SetSpi|
|00002290| 6e 20 73 65 74 73 20 74 | 68 65 20 73 70 69 6e 20 |n sets t|he spin |
|000022a0| 72 6f 75 74 69 6e 65 2e | 20 20 54 68 65 20 73 70 |routine.| The sp|
|000022b0| 69 6e 20 72 6f 75 74 69 | 6e 65 20 69 73 20 61 20 |in routi|ne is a |
|000022c0| 73 65 63 6f 6e 64 61 72 | 79 20 65 76 65 6e 74 20 |secondar|y event |
|000022d0| 6c 6f 6f 70 20 63 61 6c | 6c 65 64 0d 72 65 70 65 |loop cal|led.repe|
|000022e0| 61 74 65 64 6c 79 20 62 | 79 20 69 70 6c 6f 77 2e |atedly b|y iplow.|
|000022f0| 63 20 77 68 69 6c 65 20 | 77 61 69 74 69 6e 67 20 |c while |waiting |
|00002300| 66 6f 72 20 4d 61 63 54 | 43 50 20 63 61 6c 6c 73 |for MacT|CP calls|
|00002310| 20 74 6f 20 63 6f 6d 70 | 6c 65 74 65 2e 20 20 54 | to comp|lete. T|
|00002320| 68 69 73 20 61 6c 6c 6f | 77 73 0d 6f 74 68 65 72 |his allo|ws.other|
|00002330| 20 70 72 6f 63 65 73 73 | 65 73 20 6f 6e 20 74 68 | process|es on th|
|00002340| 65 20 4d 61 63 69 6e 74 | 6f 73 68 20 74 6f 20 63 |e Macint|osh to c|
|00002350| 6f 6e 74 69 6e 75 65 20 | 6f 70 65 72 61 74 69 6e |ontinue |operatin|
|00002360| 67 20 69 6e 20 74 68 65 | 69 72 20 63 6f 2d 6f 70 |g in the|ir co-op|
|00002370| 65 72 61 74 69 76 65 0d | 6d 75 6c 74 69 2d 74 61 |erative.|multi-ta|
|00002380| 73 6b 69 6e 67 20 65 6e | 76 69 72 6f 6e 6d 65 6e |sking en|vironmen|
|00002390| 74 2e 20 20 46 6f 72 20 | 69 6e 66 6f 72 6d 61 74 |t. For |informat|
|000023a0| 69 6f 6e 20 6f 6e 20 77 | 72 69 74 69 6e 67 20 79 |ion on w|riting y|
|000023b0| 6f 75 72 20 6f 77 6e 20 | 73 70 69 6e 20 72 6f 75 |our own |spin rou|
|000023c0| 74 69 6e 65 2c 20 73 65 | 65 0d 22 4d 61 6b 69 6e |tine, se|e."Makin|
|000023d0| 67 20 59 6f 75 72 20 4f | 77 6e 20 53 70 69 6e 20 |g Your O|wn Spin |
|000023e0| 52 6f 75 74 69 6e 65 73 | 22 20 62 65 6c 6f 77 2e |Routines|" below.|
|000023f0| 0d 0d 0d 41 44 44 52 45 | 53 53 20 43 4f 4e 56 45 |...ADDRE|SS CONVE|
|00002400| 52 53 49 4f 4e 20 41 4e | 44 20 4c 4f 4f 4b 55 50 |RSION AN|D LOOKUP|
|00002410| 20 52 4f 55 54 49 4e 45 | 53 0d 0d 0d 6e 75 6d 32 | ROUTINE|S...num2|
|00002420| 64 6f 74 0d 0d 09 76 6f | 69 64 20 6e 75 6d 32 64 |dot...vo|id num2d|
|00002430| 6f 74 28 75 6e 73 69 67 | 6e 65 64 20 6c 6f 6e 67 |ot(unsig|ned long|
|00002440| 20 69 70 2c 20 63 68 61 | 72 20 2a 64 6f 74 29 0d | ip, cha|r *dot).|
|00002450| 0d 6e 75 6d 32 64 6f 74 | 20 69 73 20 61 20 73 6d |.num2dot| is a sm|
|00002460| 61 6c 6c 20 72 6f 75 74 | 69 6e 65 20 74 6f 20 63 |all rout|ine to c|
|00002470| 6f 6e 76 65 72 74 20 61 | 6e 20 75 6e 73 69 67 6e |onvert a|n unsign|
|00002480| 65 64 20 6c 6f 6e 67 20 | 69 70 20 6e 75 6d 62 65 |ed long |ip numbe|
|00002490| 72 20 69 6e 74 6f 20 74 | 68 65 0d 68 75 6d 61 6e |r into t|he.human|
|000024a0| 2d 72 65 61 64 61 62 6c | 65 20 64 6f 74 20 6e 6f |-readabl|e dot no|
|000024b0| 74 61 74 69 6f 6e 20 28 | 65 2e 67 2e 2c 20 32 34 |tation (|e.g., 24|
|000024c0| 32 31 37 36 32 30 35 34 | 20 62 65 63 6f 6d 65 73 |21762054| becomes|
|000024d0| 20 22 31 34 34 2e 38 39 | 2e 34 30 2e 36 22 29 2e | "144.89|.40.6").|
|000024e0| 20 20 54 6f 20 62 65 0d | 73 61 66 65 2c 20 64 6f | To be.|safe, do|
|000024f0| 74 20 73 68 6f 75 6c 64 | 20 70 6f 69 6e 74 20 74 |t should| point t|
|00002500| 6f 20 61 74 20 6c 65 61 | 73 74 20 31 36 20 62 79 |o at lea|st 16 by|
|00002510| 74 65 73 20 6f 66 20 6d | 65 6d 6f 72 79 2e 0d 0d |tes of m|emory...|
|00002520| 6e 75 6d 32 64 6f 74 20 | 69 73 6e 27 74 20 70 61 |num2dot |isn't pa|
|00002530| 72 74 20 6f 66 20 42 53 | 44 20 55 4e 49 58 20 73 |rt of BS|D UNIX s|
|00002540| 6f 63 6b 65 74 73 2e 0d | 0d 0d 43 6f 6e 76 65 72 |ockets..|..Conver|
|00002550| 74 53 74 72 54 6f 41 64 | 64 72 0d 0d 09 4f 53 45 |tStrToAd|dr...OSE|
|00002560| 72 72 20 43 6f 6e 76 65 | 72 74 53 74 72 54 6f 41 |rr Conve|rtStrToA|
|00002570| 64 64 72 28 63 68 61 72 | 20 2a 6e 61 6d 65 2c 20 |ddr(char| *name, |
|00002580| 75 6e 73 69 67 6e 65 64 | 20 6c 6f 6e 67 20 2a 69 |unsigned| long *i|
|00002590| 70 4e 75 6d 29 0d 0d 54 | 68 69 73 20 72 6f 75 74 |pNum)..T|his rout|
|000025a0| 69 6e 65 20 63 6f 6e 76 | 65 72 74 73 20 73 74 72 |ine conv|erts str|
|000025b0| 69 6e 67 73 20 74 6f 20 | 75 6e 73 69 67 6e 65 64 |ings to |unsigned|
|000025c0| 20 6c 6f 6e 67 20 69 70 | 20 6e 75 6d 62 65 72 73 | long ip| numbers|
|000025d0| 2e 20 20 54 68 65 20 73 | 74 72 69 6e 67 20 63 61 |. The s|tring ca|
|000025e0| 6e 0d 63 6f 6e 74 61 69 | 6e 20 65 69 74 68 65 72 |n.contai|n either|
|000025f0| 20 61 20 64 6f 74 20 6e | 6f 74 61 74 69 6f 6e 20 | a dot n|otation |
|00002600| 69 70 20 61 64 64 72 65 | 73 73 20 28 65 2e 67 2e |ip addre|ss (e.g.|
|00002610| 2c 20 22 31 34 34 2e 38 | 39 2e 34 30 2e 36 22 29 |, "144.8|9.40.6")|
|00002620| 2c 20 6f 72 20 61 20 44 | 4e 53 20 68 6f 73 74 0d |, or a D|NS host.|
|00002630| 6e 61 6d 65 20 28 65 2e | 67 2e 2c 20 22 73 74 75 |name (e.|g., "stu|
|00002640| 2e 62 65 6c 6f 69 74 2e | 65 64 75 22 29 2e 20 20 |.beloit.|edu"). |
|00002650| 49 74 20 72 65 74 75 72 | 6e 73 20 61 6e 20 4f 53 |It retur|ns an OS|
|00002660| 45 72 72 20 70 61 73 73 | 65 64 20 6f 6e 20 66 72 |Err pass|ed on fr|
|00002670| 6f 6d 20 4d 61 63 54 43 | 50 2e 0d 0d 43 6f 6e 76 |om MacTC|P...Conv|
|00002680| 65 72 74 53 74 72 54 6f | 41 64 64 72 20 69 73 6e |ertStrTo|Addr isn|
|00002690| 27 74 20 70 61 72 74 20 | 6f 66 20 42 53 44 20 55 |'t part |of BSD U|
|000026a0| 4e 49 58 20 73 6f 63 6b | 65 74 73 2e 0d 0d 0d 47 |NIX sock|ets....G|
|000026b0| 65 74 48 6f 73 74 42 79 | 4e 61 6d 65 0d 0d 09 75 |etHostBy|Name...u|
|000026c0| 6e 73 69 67 6e 65 64 20 | 6c 6f 6e 67 20 47 65 74 |nsigned |long Get|
|000026d0| 48 6f 73 74 42 79 4e 61 | 6d 65 28 63 68 61 72 20 |HostByNa|me(char |
|000026e0| 2a 6e 61 6d 65 29 0d 0d | 47 65 74 48 6f 73 74 42 |*name)..|GetHostB|
|000026f0| 79 4e 61 6d 65 20 65 6d | 75 6c 61 74 65 73 20 74 |yName em|ulates t|
|00002700| 68 65 20 55 4e 49 58 20 | 72 6f 75 74 69 6e 65 20 |he UNIX |routine |
|00002710| 62 79 20 74 68 65 20 73 | 61 6d 65 20 6e 61 6d 65 |by the s|ame name|
|00002720| 20 28 67 65 74 68 6f 73 | 74 62 79 6e 61 6d 65 20 | (gethos|tbyname |
|00002730| 69 73 0d 23 64 65 66 69 | 6e 65 64 20 61 73 20 47 |is.#defi|ned as G|
|00002740| 65 74 48 6f 73 74 42 79 | 4e 61 6d 65 29 2e 20 20 |etHostBy|Name). |
|00002750| 47 69 76 65 6e 20 61 20 | 73 74 72 69 6e 67 20 63 |Given a |string c|
|00002760| 6f 6e 74 61 69 6e 69 6e | 67 20 61 20 44 4e 53 20 |ontainin|g a DNS |
|00002770| 6e 61 6d 65 20 6f 72 20 | 61 20 64 6f 74 0d 73 65 |name or |a dot.se|
|00002780| 70 61 72 61 74 65 64 20 | 6e 75 6d 62 65 72 2c 20 |parated |number, |
|00002790| 47 65 74 48 6f 73 74 42 | 79 4e 61 6d 65 20 77 69 |GetHostB|yName wi|
|000027a0| 6c 6c 20 72 65 74 75 72 | 6e 20 74 68 61 74 20 68 |ll retur|n that h|
|000027b0| 6f 73 74 27 73 20 75 6e | 73 69 67 6e 65 64 20 6c |ost's un|signed l|
|000027c0| 6f 6e 67 20 69 70 20 6e | 75 6d 62 65 72 2e 20 0d |ong ip n|umber. .|
|000027d0| 49 66 20 61 6e 20 65 72 | 72 6f 72 20 6f 63 63 75 |If an er|ror occu|
|000027e0| 72 73 2c 20 47 65 74 48 | 6f 73 74 42 79 4e 61 6d |rs, GetH|ostByNam|
|000027f0| 65 20 77 69 6c 6c 20 72 | 65 74 75 72 6e 20 30 2e |e will r|eturn 0.|
|00002800| 0d 0d 0d 47 65 74 50 72 | 6f 74 6f 42 79 4e 61 6d |...GetPr|otoByNam|
|00002810| 65 0d 0d 09 69 6e 74 20 | 47 65 74 50 72 6f 74 6f |e...int |GetProto|
|00002820| 42 79 4e 61 6d 65 28 63 | 68 61 72 20 2a 6e 61 6d |ByName(c|har *nam|
|00002830| 65 29 0d 0d 47 65 74 50 | 72 6f 74 6f 42 79 4e 61 |e)..GetP|rotoByNa|
|00002840| 6d 65 20 72 6f 75 67 68 | 6c 79 20 65 6d 75 6c 61 |me rough|ly emula|
|00002850| 74 65 73 20 74 68 65 20 | 55 4e 49 58 20 72 6f 75 |tes the |UNIX rou|
|00002860| 74 69 6e 65 20 62 79 20 | 74 68 65 20 73 61 6d 65 |tine by |the same|
|00002870| 20 6e 61 6d 65 20 28 67 | 65 74 70 72 6f 74 6f 62 | name (g|etprotob|
|00002880| 79 6e 61 6d 65 0d 69 73 | 20 23 64 65 66 69 6e 65 |yname.is| #define|
|00002890| 64 20 61 73 20 47 65 74 | 50 72 6f 74 6f 42 79 4e |d as Get|ProtoByN|
|000028a0| 61 6d 65 20 69 6e 20 69 | 70 2e 68 29 2e 20 20 47 |ame in i|p.h). G|
|000028b0| 69 76 65 6e 20 61 20 73 | 74 72 69 6e 67 20 63 6f |iven a s|tring co|
|000028c0| 6e 74 61 69 6e 69 6e 67 | 20 74 68 65 20 6e 61 6d |ntaining| the nam|
|000028d0| 65 20 6f 66 20 61 0d 6e | 65 74 77 6f 72 6b 20 70 |e of a.n|etwork p|
|000028e0| 72 6f 74 6f 63 6f 6c 2c | 20 47 65 74 50 72 6f 74 |rotocol,| GetProt|
|000028f0| 6f 42 79 4e 61 6d 65 20 | 77 69 6c 6c 20 72 65 74 |oByName |will ret|
|00002900| 75 72 6e 20 74 68 65 20 | 69 6e 74 65 67 65 72 20 |urn the |integer |
|00002910| 63 6f 72 72 65 73 70 6f | 6e 64 69 6e 67 20 74 6f |correspo|nding to|
|00002920| 20 69 74 27 73 0d 70 72 | 6f 74 6f 63 6f 6c 3b 20 | it's.pr|otocol; |
|00002930| 69 74 20 77 69 6c 6c 20 | 72 65 74 75 72 6e 20 30 |it will |return 0|
|00002940| 20 69 66 20 69 74 20 64 | 6f 65 73 6e 27 74 20 72 | if it d|oesn't r|
|00002950| 65 63 6f 67 6e 69 7a 65 | 20 74 68 65 20 70 72 6f |ecognize| the pro|
|00002960| 74 6f 63 6f 6c 2e 20 20 | 43 75 72 72 65 6e 74 6c |tocol. |Currentl|
|00002970| 79 2c 0d 47 65 74 50 72 | 6f 74 6f 42 79 4e 61 6d |y,.GetPr|otoByNam|
|00002980| 65 20 6f 6e 6c 79 20 75 | 6e 64 65 72 73 74 61 6e |e only u|nderstan|
|00002990| 64 73 20 22 74 63 70 22 | 20 61 6e 64 20 22 75 64 |ds "tcp"| and "ud|
|000029a0| 70 22 2e 0d 0d 54 68 69 | 73 20 72 6f 75 74 69 6e |p"...Thi|s routin|
|000029b0| 65 20 64 69 66 66 65 72 | 73 20 66 72 6f 6d 20 74 |e differ|s from t|
|000029c0| 68 65 20 55 4e 49 58 20 | 72 6f 75 74 69 6e 65 20 |he UNIX |routine |
|000029d0| 69 6e 20 74 68 61 74 20 | 69 74 20 72 65 74 75 72 |in that |it retur|
|000029e0| 6e 73 20 61 20 73 69 6d | 70 6c 65 20 69 6e 74 2c |ns a sim|ple int,|
|000029f0| 0d 72 61 74 68 65 72 20 | 74 68 61 6e 20 61 20 72 |.rather |than a r|
|00002a00| 65 63 6f 72 64 20 6f 66 | 20 69 6e 66 6f 72 6d 61 |ecord of| informa|
|00002a10| 74 69 6f 6e 2e 20 20 54 | 68 69 73 20 69 73 20 6c |tion. T|his is l|
|00002a20| 61 72 67 65 6c 79 20 62 | 65 63 61 75 73 65 20 4d |argely b|ecause M|
|00002a30| 61 63 54 43 50 20 6f 6e | 6c 79 0d 75 6e 64 65 72 |acTCP on|ly.under|
|00002a40| 73 74 61 6e 64 73 20 54 | 43 50 2f 49 50 20 61 6e |stands T|CP/IP an|
|00002a50| 64 20 55 44 50 2f 49 50 | 2e 0d 0d 0d 47 65 74 48 |d UDP/IP|....GetH|
|00002a60| 6f 73 74 4e 61 6d 65 0d | 0d 09 69 6e 74 20 47 65 |ostName.|..int Ge|
|00002a70| 74 48 6f 73 74 4e 61 6d | 65 28 63 68 61 72 20 2a |tHostNam|e(char *|
|00002a80| 6e 61 6d 65 2c 20 69 6e | 74 20 6e 61 6d 65 6c 65 |name, in|t namele|
|00002a90| 6e 29 0d 0d 47 65 74 48 | 6f 73 74 4e 61 6d 65 20 |n)..GetH|ostName |
|00002aa0| 65 6d 75 6c 61 74 65 73 | 20 74 68 65 20 55 4e 49 |emulates| the UNI|
|00002ab0| 58 20 72 6f 75 74 69 6e | 65 20 62 79 20 74 68 65 |X routin|e by the|
|00002ac0| 20 73 61 6d 65 20 6e 61 | 6d 65 20 28 67 65 74 68 | same na|me (geth|
|00002ad0| 6f 73 74 6e 61 6d 65 20 | 69 73 20 23 64 65 66 69 |ostname |is #defi|
|00002ae0| 6e 65 64 0d 61 73 20 47 | 65 74 48 6f 73 74 4e 61 |ned.as G|etHostNa|
|00002af0| 6d 65 29 2e 20 47 65 74 | 48 6f 73 74 4e 61 6d 65 |me). Get|HostName|
|00002b00| 20 72 65 74 75 72 6e 73 | 20 74 68 65 20 6e 61 6d | returns| the nam|
|00002b10| 65 20 6f 66 20 74 68 65 | 20 6c 6f 63 61 6c 20 63 |e of the| local c|
|00002b20| 6f 6d 70 75 74 65 72 20 | 69 6e 20 6e 61 6d 65 2e |omputer |in name.|
|00002b30| 20 20 54 68 65 0d 72 6f | 75 74 69 6e 65 20 72 65 | The.ro|utine re|
|00002b40| 74 75 72 6e 73 20 30 20 | 69 66 20 73 75 63 63 65 |turns 0 |if succe|
|00002b50| 73 73 66 75 6c 3b 20 69 | 74 20 77 69 6c 6c 20 72 |ssful; i|t will r|
|00002b60| 65 74 75 72 6e 20 2d 31 | 20 69 66 20 61 6e 20 65 |eturn -1| if an e|
|00002b70| 72 72 6f 72 20 6f 63 63 | 75 72 72 65 64 2e 0d 0d |rror occ|urred...|
|00002b80| 4e 6f 74 65 3a 20 53 69 | 6e 63 65 20 61 6e 79 20 |Note: Si|nce any |
|00002b90| 67 69 76 65 6e 20 4d 61 | 63 69 6e 74 6f 73 68 20 |given Ma|cintosh |
|00002ba0| 6d 61 79 20 6e 6f 74 20 | 68 61 76 65 20 61 20 6c |may not |have a l|
|00002bb0| 6f 63 61 6c 20 6e 61 6d | 65 20 28 75 6e 6c 69 6b |ocal nam|e (unlik|
|00002bc0| 65 20 55 4e 49 58 20 6d | 61 63 68 69 6e 65 73 0d |e UNIX m|achines.|
|00002bd0| 77 68 69 63 68 20 44 4f | 20 68 61 76 65 20 6c 6f |which DO| have lo|
|00002be0| 63 61 6c 20 6e 61 6d 65 | 73 29 2c 20 47 65 74 48 |cal name|s), GetH|
|00002bf0| 6f 73 74 4e 61 6d 65 20 | 77 69 6c 6c 20 72 65 74 |ostName |will ret|
|00002c00| 75 72 6e 20 74 68 65 20 | 6c 6f 63 61 6c 20 68 6f |urn the |local ho|
|00002c10| 73 74 27 73 0d 64 6f 74 | 2d 73 65 70 61 72 61 74 |st's.dot|-separat|
|00002c20| 65 64 20 49 50 20 6e 75 | 6d 62 65 72 20 69 66 20 |ed IP nu|mber if |
|00002c30| 6e 6f 20 44 4e 53 20 6e | 61 6d 65 20 65 78 69 73 |no DNS n|ame exis|
|00002c40| 74 73 20 66 6f 72 20 74 | 68 65 20 6c 6f 63 61 6c |ts for t|he local|
|00002c50| 20 6d 61 63 68 69 6e 65 | 2e 0d 0d 57 61 72 6e 69 | machine|...Warni|
|00002c60| 6e 67 3a 20 43 75 72 72 | 65 6e 74 6c 79 2c 20 6e |ng: Curr|ently, n|
|00002c70| 61 6d 65 6c 65 6e 20 69 | 73 20 75 6e 75 73 65 64 |amelen i|s unused|
|00002c80| 2c 20 70 72 6f 76 69 64 | 65 64 20 6f 6e 6c 79 20 |, provid|ed only |
|00002c90| 66 6f 72 20 55 4e 49 58 | 20 63 6f 6d 70 61 74 69 |for UNIX| compati|
|00002ca0| 62 69 6c 69 74 79 2e 20 | 0d 6e 61 6d 65 20 6d 75 |bility. |.name mu|
|00002cb0| 73 74 20 70 6f 69 6e 74 | 20 74 6f 20 61 20 22 73 |st point| to a "s|
|00002cc0| 75 66 66 69 63 69 65 6e | 74 6c 79 20 6c 61 72 67 |ufficien|tly larg|
|00002cd0| 65 22 20 61 6d 6f 75 6e | 74 20 6f 66 20 6d 65 6d |e" amoun|t of mem|
|00002ce0| 6f 72 79 2e 20 20 54 68 | 69 73 20 73 68 6f 75 6c |ory. Th|is shoul|
|00002cf0| 64 20 62 65 20 66 69 78 | 65 64 0d 69 6e 20 74 68 |d be fix|ed.in th|
|00002d00| 65 20 66 75 74 75 72 65 | 2e 0d 0d 0d 47 65 74 48 |e future|....GetH|
|00002d10| 6f 73 74 4e 61 6d 65 4f | 6e 6c 79 0d 0d 09 69 6e |ostNameO|nly...in|
|00002d20| 74 20 47 65 74 48 6f 73 | 74 4e 61 6d 65 4f 6e 6c |t GetHos|tNameOnl|
|00002d30| 79 28 63 68 61 72 20 2a | 6e 61 6d 65 29 0d 0d 47 |y(char *|name)..G|
|00002d40| 65 74 48 6f 73 74 4e 61 | 6d 65 4f 6e 6c 79 20 69 |etHostNa|meOnly i|
|00002d50| 73 20 61 20 73 70 69 6e | 6f 66 66 20 6f 66 20 47 |s a spin|off of G|
|00002d60| 65 74 48 6f 73 74 4e 61 | 6d 65 2e 20 20 49 74 20 |etHostNa|me. It |
|00002d70| 69 73 20 69 64 65 6e 74 | 69 63 61 6c 20 74 6f 20 |is ident|ical to |
|00002d80| 47 65 74 48 6f 73 74 4e | 61 6d 65 0d 65 78 63 65 |GetHostN|ame.exce|
|00002d90| 70 74 20 74 68 61 74 20 | 69 66 20 74 68 65 20 6c |pt that |if the l|
|00002da0| 6f 63 61 6c 20 68 6f 73 | 74 20 64 6f 65 73 6e 27 |ocal hos|t doesn'|
|00002db0| 74 20 68 61 76 65 20 61 | 20 44 4e 53 20 6e 61 6d |t have a| DNS nam|
|00002dc0| 65 2c 20 47 65 74 48 6f | 73 74 4e 61 6d 65 4f 6e |e, GetHo|stNameOn|
|00002dd0| 6c 79 20 77 69 6c 6c 20 | 66 61 69 6c 2c 0d 72 61 |ly will |fail,.ra|
|00002de0| 74 68 65 72 20 74 68 61 | 6e 20 72 65 74 75 72 6e |ther tha|n return|
|00002df0| 69 6e 67 20 61 20 64 6f | 74 2d 73 65 70 61 72 61 |ing a do|t-separa|
|00002e00| 74 65 64 20 49 50 20 6e | 75 6d 62 65 72 2e 20 20 |ted IP n|umber. |
|00002e10| 6e 61 6d 65 20 73 68 6f | 75 6c 64 20 70 6f 69 6e |name sho|uld poin|
|00002e20| 74 20 74 6f 20 61 0d 22 | 73 75 66 66 69 63 69 65 |t to a."|sufficie|
|00002e30| 6e 74 6c 79 20 6c 61 72 | 67 65 22 20 61 6d 6f 75 |ntly lar|ge" amou|
|00002e40| 6e 74 20 6f 66 20 6d 65 | 6d 6f 72 79 2e 20 20 47 |nt of me|mory. G|
|00002e50| 65 74 48 6f 73 74 4e 61 | 6d 65 4f 6e 6c 79 20 72 |etHostNa|meOnly r|
|00002e60| 65 74 75 72 6e 73 20 30 | 20 69 66 20 73 75 63 63 |eturns 0| if succ|
|00002e70| 65 73 73 66 75 6c 3b 0d | 6f 74 68 65 72 77 69 73 |essful;.|otherwis|
|00002e80| 65 20 69 74 20 72 65 74 | 75 72 6e 73 20 2d 31 2e |e it ret|urns -1.|
|00002e90| 0d 0d 0d 47 65 74 4d 79 | 49 50 44 6f 74 0d 0d 09 |...GetMy|IPDot...|
|00002ea0| 69 6e 74 20 47 65 74 4d | 79 49 50 44 6f 74 28 63 |int GetM|yIPDot(c|
|00002eb0| 68 61 72 20 2a 6e 75 6d | 29 0d 0d 47 65 74 4d 79 |har *num|)..GetMy|
|00002ec0| 49 50 44 6f 74 20 72 65 | 74 75 72 6e 73 20 74 68 |IPDot re|turns th|
|00002ed0| 65 20 64 6f 74 2d 73 65 | 70 61 72 61 74 65 64 20 |e dot-se|parated |
|00002ee0| 49 50 20 61 64 64 72 65 | 73 73 20 6f 66 20 74 68 |IP addre|ss of th|
|00002ef0| 65 20 6c 6f 63 61 6c 20 | 6d 61 63 68 69 6e 65 20 |e local |machine |
|00002f00| 69 6e 20 6e 75 6d 2e 20 | 20 6e 75 6d 0d 73 68 6f |in num. | num.sho|
|00002f10| 75 6c 64 20 70 6f 69 6e | 74 20 74 6f 20 61 74 20 |uld poin|t to at |
|00002f20| 6c 65 61 73 74 20 31 36 | 20 62 79 74 65 73 20 6f |least 16| bytes o|
|00002f30| 66 20 6d 65 6d 6f 72 79 | 2e 20 20 47 65 74 4d 79 |f memory|. GetMy|
|00002f40| 49 50 44 6f 74 20 72 65 | 74 75 72 6e 73 20 30 20 |IPDot re|turns 0 |
|00002f50| 69 66 20 73 75 63 63 65 | 73 73 66 75 6c 3b 0d 6f |if succe|ssful;.o|
|00002f60| 74 68 65 72 77 69 73 65 | 20 69 74 20 72 65 74 75 |therwise| it retu|
|00002f70| 72 6e 73 20 2d 31 2e 0d | 0d 47 65 74 4d 79 49 50 |rns -1..|.GetMyIP|
|00002f80| 44 6f 74 20 69 73 6e 27 | 74 20 70 61 72 74 20 6f |Dot isn'|t part o|
|00002f90| 66 20 42 53 44 20 55 4e | 49 58 20 73 6f 63 6b 65 |f BSD UN|IX socke|
|00002fa0| 74 73 2e 0d 0d 0d 47 65 | 74 4d 79 49 50 4e 75 6d |ts....Ge|tMyIPNum|
|00002fb0| 0d 0d 09 75 6e 73 69 67 | 6e 65 64 20 6c 6f 6e 67 |...unsig|ned long|
|00002fc0| 20 47 65 74 4d 79 49 50 | 4e 75 6d 28 76 6f 69 64 | GetMyIP|Num(void|
|00002fd0| 29 0d 0d 47 65 74 4d 79 | 49 50 4e 75 6d 20 72 65 |)..GetMy|IPNum re|
|00002fe0| 74 75 72 6e 73 20 74 68 | 65 20 75 6e 73 69 67 6e |turns th|e unsign|
|00002ff0| 65 64 20 6c 6f 6e 67 20 | 49 50 20 61 64 64 72 65 |ed long |IP addre|
|00003000| 73 73 20 6f 66 20 74 68 | 65 20 6c 6f 63 61 6c 20 |ss of th|e local |
|00003010| 6d 61 63 68 69 6e 65 3b | 20 69 74 20 72 65 74 75 |machine;| it retu|
|00003020| 72 6e 73 0d 2d 31 20 69 | 66 20 61 6e 20 65 72 72 |rns.-1 i|f an err|
|00003030| 6f 72 20 6f 63 63 75 72 | 73 2e 0d 0d 47 65 74 4d |or occur|s...GetM|
|00003040| 79 49 50 4e 75 6d 20 69 | 73 6e 27 74 20 70 61 72 |yIPNum i|sn't par|
|00003050| 74 20 6f 66 20 42 53 44 | 20 55 4e 49 58 20 73 6f |t of BSD| UNIX so|
|00003060| 63 6b 65 74 73 2e 0d 0d | 0d 67 65 74 73 6f 63 6b |ckets...|.getsock|
|00003070| 6e 61 6d 65 0d 0d 09 69 | 6e 74 20 67 65 74 73 6f |name...i|nt getso|
|00003080| 63 6b 6e 61 6d 65 20 28 | 69 6e 74 20 73 6f 63 6b |ckname (|int sock|
|00003090| 2c 20 73 74 72 75 63 74 | 20 73 6f 63 6b 61 64 64 |, struct| sockadd|
|000030a0| 72 5f 69 6e 20 2a 6c 6f | 63 61 6c 61 64 64 72 2c |r_in *lo|caladdr,|
|000030b0| 20 69 6e 74 20 2a 61 64 | 64 72 6c 65 6e 29 0d 0d | int *ad|drlen)..|
|000030c0| 67 65 74 73 6f 63 6b 6e | 61 6d 65 20 69 73 20 69 |getsockn|ame is i|
|000030d0| 64 65 6e 74 69 63 61 6c | 20 74 6f 20 74 68 65 20 |dentical| to the |
|000030e0| 55 4e 49 58 20 66 75 6e | 63 74 69 6f 6e 20 77 69 |UNIX fun|ction wi|
|000030f0| 74 68 20 74 68 65 20 73 | 61 6d 65 20 6e 61 6d 65 |th the s|ame name|
|00003100| 2c 20 65 78 63 65 70 74 | 0d 6c 6f 63 61 6c 61 64 |, except|.localad|
|00003110| 64 72 20 69 73 20 61 20 | 73 74 72 75 63 74 20 73 |dr is a |struct s|
|00003120| 6f 63 6b 61 64 64 72 5f | 69 6e 20 2a 20 72 61 74 |ockaddr_|in * rat|
|00003130| 68 65 72 20 74 68 61 6e | 20 61 20 73 74 72 75 63 |her than| a struc|
|00003140| 74 20 73 6f 63 6b 61 64 | 64 72 20 2a 2e 20 20 6c |t sockad|dr *. l|
|00003150| 6f 63 61 6c 61 64 64 72 | 0d 70 6f 69 6e 74 73 20 |ocaladdr|.points |
|00003160| 74 6f 20 61 20 73 6f 63 | 6b 61 64 64 72 5f 69 6e |to a soc|kaddr_in|
|00003170| 20 73 74 72 75 63 74 20 | 63 6f 6e 74 61 69 6e 69 | struct |containi|
|00003180| 6e 67 20 74 68 65 20 70 | 6f 72 74 20 61 6e 64 20 |ng the p|ort and |
|00003190| 69 70 20 6e 75 6d 62 65 | 72 73 20 6f 66 20 74 68 |ip numbe|rs of th|
|000031a0| 65 20 6c 6f 63 61 6c 0d | 68 6f 73 74 2e 20 2a 61 |e local.|host. *a|
|000031b0| 64 64 72 6c 65 6e 20 77 | 69 6c 6c 20 62 65 20 73 |ddrlen w|ill be s|
|000031c0| 65 74 20 74 6f 20 74 68 | 65 20 73 69 7a 65 20 6f |et to th|e size o|
|000031d0| 66 20 74 68 65 20 73 6f | 63 6b 61 64 64 72 5f 69 |f the so|ckaddr_i|
|000031e0| 6e 20 73 74 72 75 63 74 | 2e 20 20 67 65 74 73 6f |n struct|. getso|
|000031f0| 63 6b 6e 61 6d 65 0d 72 | 65 74 75 72 6e 73 20 30 |ckname.r|eturns 0|
|00003200| 20 69 66 20 73 75 63 63 | 65 73 73 66 75 6c 3b 20 | if succ|essful; |
|00003210| 6f 74 68 65 72 77 69 73 | 65 20 69 74 20 72 65 74 |otherwis|e it ret|
|00003220| 75 72 6e 73 20 2d 31 2e | 0d 0d 54 68 69 73 20 72 |urns -1.|..This r|
|00003230| 6f 75 74 69 6e 65 20 77 | 61 73 20 6f 72 69 67 69 |outine w|as origi|
|00003240| 6e 61 6c 6c 79 20 63 6f | 6e 74 72 69 62 75 74 65 |nally co|ntribute|
|00003250| 64 20 62 79 20 4c 69 6d | 20 57 61 69 20 4b 6f 6e |d by Lim| Wai Kon|
|00003260| 67 20 44 61 76 69 64 0d | 3c 6c 69 6d 77 61 69 6b |g David.|<limwaik|
|00003270| 6f 40 69 73 63 73 2e 6e | 75 73 2e 73 67 3e 2e 0d |o@iscs.n|us.sg>..|
|00003280| 0d 0d 47 45 4e 45 52 41 | 4c 20 49 50 20 52 4f 55 |..GENERA|L IP ROU|
|00003290| 54 49 4e 45 53 0d 0d 0d | 73 6f 63 6b 65 74 0d 0d |TINES...|socket..|
|000032a0| 09 69 6e 74 20 73 6f 63 | 6b 65 74 28 69 6e 74 20 |.int soc|ket(int |
|000032b0| 66 61 6d 69 6c 79 2c 20 | 69 6e 74 20 74 79 70 65 |family, |int type|
|000032c0| 2c 20 69 6e 74 20 70 72 | 6f 74 6f 63 6f 6c 29 0d |, int pr|otocol).|
|000032d0| 0d 73 6f 63 6b 65 74 20 | 72 6f 75 67 68 6c 79 20 |.socket |roughly |
|000032e0| 65 6d 75 6c 61 74 65 73 | 20 74 68 65 20 55 4e 49 |emulates| the UNI|
|000032f0| 58 20 66 75 6e 63 74 69 | 6f 6e 20 77 69 74 68 20 |X functi|on with |
|00003300| 74 68 65 20 73 61 6d 65 | 20 6e 61 6d 65 2e 20 20 |the same| name. |
|00003310| 54 68 65 20 76 61 72 69 | 61 62 6c 65 73 0d 66 61 |The vari|ables.fa|
|00003320| 6d 69 6c 79 20 61 6e 64 | 20 74 79 70 65 20 61 72 |mily and| type ar|
|00003330| 65 20 6e 6f 74 20 75 73 | 65 64 2c 20 74 68 65 79 |e not us|ed, they|
|00003340| 20 61 72 65 20 70 72 6f | 76 69 64 65 64 20 73 6f | are pro|vided so|
|00003350| 6c 65 6c 79 20 66 6f 72 | 20 63 6f 6d 70 61 74 69 |lely for| compati|
|00003360| 62 69 6c 69 74 79 20 77 | 69 74 68 0d 55 4e 49 58 |bility w|ith.UNIX|
|00003370| 20 63 6f 64 65 2e 20 54 | 68 65 20 76 61 72 69 61 | code. T|he varia|
|00003380| 62 6c 65 20 70 72 6f 74 | 6f 63 6f 6c 20 6d 75 73 |ble prot|ocol mus|
|00003390| 74 20 62 65 20 65 69 74 | 68 65 72 20 49 50 50 52 |t be eit|her IPPR|
|000033a0| 4f 54 4f 5f 54 43 50 20 | 6f 72 20 49 50 50 52 4f |OTO_TCP |or IPPRO|
|000033b0| 54 4f 5f 55 44 50 2e 0d | 73 6f 63 6b 65 74 20 61 |TO_UDP..|socket a|
|000033c0| 6c 73 6f 20 72 65 73 65 | 72 76 65 73 20 73 6f 6d |lso rese|rves som|
|000033d0| 65 20 6d 65 6d 6f 72 79 | 20 66 6f 72 20 75 73 65 |e memory| for use|
|000033e0| 20 62 79 20 4d 61 63 54 | 43 50 2e 20 20 73 6f 63 | by MacT|CP. soc|
|000033f0| 6b 65 74 20 72 65 74 75 | 72 6e 73 20 61 20 73 6f |ket retu|rns a so|
|00003400| 63 6b 65 74 0d 6e 75 6d | 62 65 72 20 28 63 75 72 |cket.num|ber (cur|
|00003410| 72 65 6e 74 6c 79 20 62 | 65 74 77 65 65 6e 20 30 |rently b|etween 0|
|00003420| 20 61 6e 64 20 33 31 20 | 69 6e 63 6c 75 73 69 76 | and 31 |inclusiv|
|00003430| 65 29 20 69 66 20 73 75 | 63 63 65 73 73 66 75 6c |e) if su|ccessful|
|00003440| 3b 20 6f 74 68 65 72 77 | 69 73 65 20 69 74 20 72 |; otherw|ise it r|
|00003450| 65 74 75 72 6e 73 0d 2d | 31 2e 0d 0d 0d 63 6f 6e |eturns.-|1....con|
|00003460| 6e 65 63 74 0d 0d 09 69 | 6e 74 20 63 6f 6e 6e 65 |nect...i|nt conne|
|00003470| 63 74 28 69 6e 74 20 73 | 6f 63 6b 2c 20 73 74 72 |ct(int s|ock, str|
|00003480| 75 63 74 20 73 6f 63 6b | 61 64 64 72 5f 69 6e 20 |uct sock|addr_in |
|00003490| 2a 72 61 64 64 72 2c 20 | 69 6e 74 20 61 6c 65 6e |*raddr, |int alen|
|000034a0| 29 0d 0d 63 6f 6e 6e 65 | 63 74 20 72 6f 75 67 68 |)..conne|ct rough|
|000034b0| 6c 79 20 65 6d 75 6c 61 | 74 65 73 20 74 68 65 20 |ly emula|tes the |
|000034c0| 55 4e 49 58 20 66 75 6e | 63 74 69 6f 6e 20 77 69 |UNIX fun|ction wi|
|000034d0| 74 68 20 74 68 65 20 73 | 61 6d 65 20 6e 61 6d 65 |th the s|ame name|
|000034e0| 2c 20 65 78 63 65 70 74 | 20 6c 6f 63 61 6c 61 64 |, except| localad|
|000034f0| 64 72 0d 69 73 20 61 20 | 73 74 72 75 63 74 20 73 |dr.is a |struct s|
|00003500| 6f 63 6b 61 64 64 72 5f | 69 6e 20 2a 20 72 61 74 |ockaddr_|in * rat|
|00003510| 68 65 72 20 74 68 61 6e | 20 61 20 73 74 72 75 63 |her than| a struc|
|00003520| 74 20 73 6f 63 6b 61 64 | 64 72 20 2a 2e 20 20 49 |t sockad|dr *. I|
|00003530| 66 20 73 6f 63 6b 20 69 | 73 20 61 20 54 43 50 0d |f sock i|s a TCP.|
|00003540| 73 6f 63 6b 65 74 2c 20 | 20 63 6f 6e 6e 65 63 74 |socket, | connect|
|00003550| 20 77 69 6c 6c 20 6f 70 | 65 6e 20 61 20 63 6f 6e | will op|en a con|
|00003560| 6e 65 63 74 69 6f 6e 20 | 66 72 6f 6d 20 74 68 65 |nection |from the|
|00003570| 20 6c 6f 63 61 6c 20 68 | 6f 73 74 20 74 6f 20 74 | local h|ost to t|
|00003580| 68 65 20 72 65 6d 6f 74 | 65 20 68 6f 73 74 0d 73 |he remot|e host.s|
|00003590| 70 65 63 69 66 69 65 64 | 20 69 6e 20 2a 72 61 64 |pecified| in *rad|
|000035a0| 64 72 2e 20 20 49 66 20 | 73 6f 63 6b 20 69 73 20 |dr. If |sock is |
|000035b0| 61 20 55 44 50 20 73 6f | 63 6b 65 74 2c 20 74 68 |a UDP so|cket, th|
|000035c0| 65 20 64 65 73 74 69 6e | 61 74 69 6f 6e 20 73 70 |e destin|ation sp|
|000035d0| 65 63 69 66 69 65 64 20 | 69 6e 20 72 61 64 64 72 |ecified |in raddr|
|000035e0| 0d 69 73 20 72 65 63 6f | 72 64 65 64 20 66 6f 72 |.is reco|rded for|
|000035f0| 20 75 73 65 20 69 6e 20 | 6f 74 68 65 72 20 72 6f | use in |other ro|
|00003600| 75 74 69 6e 65 73 2e 20 | 20 63 6f 6e 6e 65 63 74 |utines. | connect|
|00003610| 20 72 65 74 75 72 6e 73 | 20 30 20 69 66 20 73 75 | returns| 0 if su|
|00003620| 63 63 65 73 73 66 75 6c | 3b 20 69 74 0d 72 65 74 |ccessful|; it.ret|
|00003630| 75 72 6e 73 20 2d 31 20 | 69 66 20 61 6e 20 65 72 |urns -1 |if an er|
|00003640| 72 6f 72 20 6f 63 63 75 | 72 73 2e 0d 0d 4e 6f 74 |ror occu|rs...Not|
|00003650| 65 3a 20 54 68 65 20 76 | 61 72 69 61 62 6c 65 20 |e: The v|ariable |
|00003660| 61 6c 65 6e 20 69 73 20 | 6e 6f 74 20 75 73 65 64 |alen is |not used|
|00003670| 2c 20 69 74 20 69 73 20 | 70 72 6f 76 69 64 65 64 |, it is |provided|
|00003680| 20 73 6f 6c 65 6c 79 20 | 66 6f 72 20 63 6f 6d 70 | solely |for comp|
|00003690| 61 74 69 62 69 6c 69 74 | 79 20 77 69 74 68 0d 55 |atibilit|y with.U|
|000036a0| 4e 49 58 20 63 6f 64 65 | 2e 0d 0d 0d 62 69 6e 64 |NIX code|....bind|
|000036b0| 0d 0d 09 69 6e 74 20 62 | 69 6e 64 20 28 69 6e 74 |...int b|ind (int|
|000036c0| 20 73 6f 63 6b 2c 20 73 | 74 72 75 63 74 20 73 6f | sock, s|truct so|
|000036d0| 63 6b 61 64 64 72 5f 69 | 6e 20 2a 6e 61 6d 65 2c |ckaddr_i|n *name,|
|000036e0| 20 69 6e 74 20 61 6c 65 | 6e 29 0d 0d 62 69 6e 64 | int ale|n)..bind|
|000036f0| 20 72 6f 75 67 68 6c 79 | 20 65 6d 75 6c 61 74 65 | roughly| emulate|
|00003700| 73 20 74 68 65 20 55 4e | 49 58 20 66 75 6e 63 74 |s the UN|IX funct|
|00003710| 69 6f 6e 20 77 69 74 68 | 20 74 68 65 20 73 61 6d |ion with| the sam|
|00003720| 65 20 6e 61 6d 65 2e 20 | 20 62 69 6e 64 20 73 70 |e name. | bind sp|
|00003730| 65 63 69 66 69 65 73 20 | 61 0d 70 6f 72 74 20 66 |ecifies |a.port f|
|00003740| 6f 72 20 61 20 73 65 72 | 76 65 72 20 74 6f 20 6c |or a ser|ver to l|
|00003750| 69 73 74 65 6e 20 74 6f | 2e 20 20 73 6f 63 6b 20 |isten to|. sock |
|00003760| 6d 61 79 20 62 65 20 65 | 69 74 68 65 72 20 61 20 |may be e|ither a |
|00003770| 55 44 50 20 6f 72 20 54 | 43 50 20 73 6f 63 6b 65 |UDP or T|CP socke|
|00003780| 74 2e 20 20 41 20 70 6f | 72 74 0d 6d 61 79 20 62 |t. A po|rt.may b|
|00003790| 65 20 62 6f 75 6e 64 20 | 74 6f 20 74 77 69 63 65 |e bound |to twice|
|000037a0| 3b 20 6f 6e 63 65 20 77 | 69 74 68 20 61 20 54 43 |; once w|ith a TC|
|000037b0| 50 20 73 6f 63 6b 65 74 | 2c 20 6f 6e 63 65 20 77 |P socket|, once w|
|000037c0| 69 74 68 20 61 20 55 44 | 50 20 73 6f 63 6b 65 74 |ith a UD|P socket|
|000037d0| 2e 20 20 62 69 6e 64 0d | 72 65 74 75 72 6e 73 20 |. bind.|returns |
|000037e0| 30 20 69 66 20 73 75 63 | 63 65 73 73 66 75 6c 3b |0 if suc|cessful;|
|000037f0| 20 69 74 20 72 65 74 75 | 72 6e 73 20 2d 31 20 69 | it retu|rns -1 i|
|00003800| 66 20 61 6e 20 65 72 72 | 6f 72 20 6f 63 63 75 72 |f an err|or occur|
|00003810| 73 2e 0d 0d 4e 6f 74 65 | 3a 20 62 69 6e 64 20 64 |s...Note|: bind d|
|00003820| 69 66 66 65 72 73 20 66 | 72 6f 6d 20 74 68 65 20 |iffers f|rom the |
|00003830| 55 4e 49 58 20 62 69 6e | 64 20 69 6e 20 73 65 76 |UNIX bin|d in sev|
|00003840| 65 72 61 6c 20 77 61 79 | 73 2e 20 46 69 72 73 74 |eral way|s. First|
|00003850| 20 6f 66 20 61 6c 6c 2c | 20 6e 61 6d 65 20 69 73 | of all,| name is|
|00003860| 20 61 0d 73 74 72 75 63 | 74 20 73 6f 63 6b 61 64 | a.struc|t sockad|
|00003870| 64 72 5f 69 6e 20 2a 20 | 72 61 74 68 65 72 20 74 |dr_in * |rather t|
|00003880| 68 61 6e 20 61 20 73 74 | 72 75 63 74 20 73 6f 63 |han a st|ruct soc|
|00003890| 6b 61 64 64 72 20 2a 2e | 20 20 53 65 63 6f 6e 64 |kaddr *.| Second|
|000038a0| 6c 79 2c 20 6e 61 6d 65 | 2d 3e 73 69 6e 5f 61 64 |ly, name|->sin_ad|
|000038b0| 64 72 0d 74 72 61 64 69 | 74 69 6f 6e 61 6c 6c 79 |dr.tradi|tionally|
|000038c0| 20 69 73 20 73 65 74 20 | 74 6f 20 49 4e 41 44 44 | is set |to INADD|
|000038d0| 52 5f 41 4e 59 20 6f 72 | 20 74 68 65 20 6c 6f 63 |R_ANY or| the loc|
|000038e0| 61 6c 20 73 79 73 74 65 | 6d 20 61 64 64 72 65 73 |al syste|m addres|
|000038f0| 73 3b 20 6e 61 6d 65 2d | 3e 73 69 6e 5f 61 64 64 |s; name-|>sin_add|
|00003900| 72 20 69 73 0d 69 67 6e | 6f 72 65 64 20 69 6e 20 |r is.ign|ored in |
|00003910| 74 68 69 73 20 69 6d 70 | 6c 65 6d 65 6e 74 61 74 |this imp|lementat|
|00003920| 69 6f 6e 2e 20 20 54 68 | 69 72 64 6c 79 2c 20 69 |ion. Th|irdly, i|
|00003930| 6e 20 55 4e 49 58 20 73 | 79 73 74 65 6d 73 2c 20 |n UNIX s|ystems, |
|00003940| 70 6f 72 74 73 20 30 20 | 2d 20 31 30 32 33 0d 28 |ports 0 |- 1023.(|
|00003950| 69 6e 63 6c 75 73 69 76 | 65 29 20 61 72 65 20 72 |inclusiv|e) are r|
|00003960| 65 73 65 72 76 65 64 20 | 66 6f 72 20 70 72 69 76 |eserved |for priv|
|00003970| 69 6c 61 67 65 64 20 70 | 72 6f 63 65 73 73 65 73 |ilaged p|rocesses|
|00003980| 3b 20 74 68 69 73 20 69 | 6d 70 6c 65 6d 65 6e 74 |; this i|mplement|
|00003990| 61 74 69 6f 6e 20 64 6f | 65 73 20 6e 6f 74 0d 70 |ation do|es not.p|
|000039a0| 72 65 73 65 72 76 65 20 | 74 68 65 20 6e 6f 74 69 |reserve |the noti|
|000039b0| 6f 6e 20 6f 66 20 72 65 | 73 65 72 76 65 64 20 70 |on of re|served p|
|000039c0| 6f 72 74 73 2e 20 20 4c | 61 73 74 6c 79 2c 20 74 |orts. L|astly, t|
|000039d0| 68 65 20 76 61 72 69 61 | 62 6c 65 20 61 6c 65 6e |he varia|ble alen|
|000039e0| 20 69 73 20 6e 6f 74 20 | 75 73 65 64 2c 20 69 74 | is not |used, it|
|000039f0| 0d 69 73 20 70 72 6f 76 | 69 64 65 64 20 73 6f 6c |.is prov|ided sol|
|00003a00| 65 6c 79 20 66 6f 72 20 | 63 6f 6d 70 61 74 69 62 |ely for |compatib|
|00003a10| 69 6c 69 74 79 20 77 69 | 74 68 20 55 4e 49 58 20 |ility wi|th UNIX |
|00003a20| 63 6f 64 65 2e 0d 0d 0d | 6c 69 73 74 65 6e 0d 0d |code....|listen..|
|00003a30| 09 69 6e 74 20 6c 69 73 | 74 65 6e 28 69 6e 74 20 |.int lis|ten(int |
|00003a40| 73 6f 63 6b 65 74 2c 20 | 69 6e 74 20 71 75 65 75 |socket, |int queu|
|00003a50| 65 6c 65 6e 29 0d 0d 6c | 69 73 74 65 6e 20 69 73 |elen)..l|isten is|
|00003a60| 20 61 20 64 75 6d 6d 79 | 20 72 6f 75 74 69 6e 65 | a dummy| routine|
|00003a70| 3b 20 70 72 6f 76 69 64 | 65 64 20 6f 6e 6c 79 20 |; provid|ed only |
|00003a80| 66 6f 72 20 55 4e 49 58 | 20 63 6f 6d 70 61 74 69 |for UNIX| compati|
|00003a90| 62 69 6c 69 74 79 2e 20 | 20 42 6f 74 68 20 76 61 |bility. | Both va|
|00003aa0| 72 69 61 62 6c 65 73 0d | 61 72 65 20 63 6f 6d 70 |riables.|are comp|
|00003ab0| 6c 65 74 65 6c 79 20 69 | 67 6e 6f 72 65 64 2e 20 |letely i|gnored. |
|00003ac0| 20 6c 69 73 74 65 6e 20 | 61 6c 77 61 79 73 20 72 | listen |always r|
|00003ad0| 65 74 75 72 6e 73 20 30 | 2e 0d 0d 49 66 20 61 6e |eturns 0|...If an|
|00003ae0| 79 6f 6e 65 20 63 61 6e | 20 74 68 69 6e 6b 20 6f |yone can| think o|
|00003af0| 66 20 61 20 77 61 79 20 | 74 6f 20 52 45 41 4c 4c |f a way |to REALL|
|00003b00| 59 20 69 6d 70 6c 65 6d | 65 6e 74 20 6c 69 73 74 |Y implem|ent list|
|00003b10| 65 6e 2c 20 49 27 64 20 | 62 65 20 67 6c 61 64 20 |en, I'd |be glad |
|00003b20| 74 6f 20 68 65 61 72 20 | 69 74 2e 0d 0d 0d 77 72 |to hear |it....wr|
|00003b30| 69 74 65 0d 0d 09 69 6e | 74 20 77 72 69 74 65 20 |ite...in|t write |
|00003b40| 28 69 6e 74 20 73 6f 63 | 6b 2c 20 50 74 72 20 64 |(int soc|k, Ptr d|
|00003b50| 61 74 61 2c 20 69 6e 74 | 20 6c 65 6e 29 0d 0d 77 |ata, int| len)..w|
|00003b60| 72 69 74 65 20 69 73 20 | 69 64 65 6e 74 69 63 61 |rite is |identica|
|00003b70| 6c 20 74 6f 20 74 68 65 | 20 55 4e 49 58 20 66 75 |l to the| UNIX fu|
|00003b80| 6e 63 74 69 6f 6e 20 77 | 69 74 68 20 74 68 65 20 |nction w|ith the |
|00003b90| 73 61 6d 65 20 6e 61 6d | 65 2e 20 20 77 72 69 74 |same nam|e. writ|
|00003ba0| 65 20 73 65 6e 64 73 20 | 6c 65 6e 0d 62 79 74 65 |e sends |len.byte|
|00003bb0| 73 20 70 6f 69 6e 74 65 | 64 20 74 6f 20 62 79 20 |s pointe|d to by |
|00003bc0| 64 61 74 61 20 61 63 72 | 6f 73 73 20 74 68 65 20 |data acr|oss the |
|00003bd0| 61 63 74 69 76 65 20 63 | 6f 6e 6e 65 63 74 69 6f |active c|onnectio|
|00003be0| 6e 20 72 65 66 65 72 65 | 6e 63 65 64 20 62 79 20 |n refere|nced by |
|00003bf0| 73 6f 63 6b 2e 20 20 73 | 6f 63 6b 0d 6d 75 73 74 |sock. s|ock.must|
|00003c00| 20 62 65 20 61 20 76 61 | 6c 69 64 2c 20 63 6f 6e | be a va|lid, con|
|00003c10| 6e 65 63 74 65 64 20 73 | 6f 63 6b 65 74 3b 20 20 |nected s|ocket; |
|00003c20| 69 74 20 63 61 6e 20 62 | 65 20 65 69 74 68 65 72 |it can b|e either|
|00003c30| 20 61 20 54 43 50 20 6f | 72 20 55 44 50 20 73 6f | a TCP o|r UDP so|
|00003c40| 63 6b 65 74 2e 20 20 77 | 72 69 74 65 0d 72 65 74 |cket. w|rite.ret|
|00003c50| 75 72 6e 73 20 74 68 65 | 20 6e 75 6d 62 65 72 20 |urns the| number |
|00003c60| 6f 66 20 62 79 74 65 73 | 20 73 75 63 63 65 73 73 |of bytes| success|
|00003c70| 66 75 6c 6c 79 20 77 72 | 69 74 74 65 6e 20 74 6f |fully wr|itten to|
|00003c80| 20 74 68 65 20 72 65 6d | 6f 74 65 20 68 6f 73 74 | the rem|ote host|
|00003c90| 3b 20 69 74 20 72 65 74 | 75 72 6e 73 0d 2d 31 20 |; it ret|urns.-1 |
|00003ca0| 69 66 20 61 6e 20 65 72 | 72 6f 72 20 70 72 65 76 |if an er|ror prev|
|00003cb0| 65 6e 74 73 20 61 6e 79 | 20 64 61 74 61 20 66 72 |ents any| data fr|
|00003cc0| 6f 6d 20 62 65 69 6e 67 | 20 73 65 6e 74 2e 0d 0d |om being| sent...|
|00003cd0| 0d 72 65 61 64 0d 0d 09 | 69 6e 74 20 72 65 61 64 |.read...|int read|
|00003ce0| 20 28 69 6e 74 20 73 6f | 63 6b 2c 20 50 74 72 20 | (int so|ck, Ptr |
|00003cf0| 62 75 66 2c 20 69 6e 74 | 20 6c 65 6e 29 0d 0d 72 |buf, int| len)..r|
|00003d00| 65 61 64 20 69 73 20 69 | 64 65 6e 74 69 63 61 6c |ead is i|dentical|
|00003d10| 20 74 6f 20 74 68 65 20 | 55 4e 49 58 20 66 75 6e | to the |UNIX fun|
|00003d20| 63 74 69 6f 6e 20 77 69 | 74 68 20 74 68 65 20 73 |ction wi|th the s|
|00003d30| 61 6d 65 20 6e 61 6d 65 | 2e 20 20 72 65 61 64 20 |ame name|. read |
|00003d40| 72 65 61 64 73 20 61 74 | 20 6d 6f 73 74 0d 6c 65 |reads at| most.le|
|00003d50| 6e 20 62 79 74 65 73 20 | 70 6f 69 6e 74 65 64 20 |n bytes |pointed |
|00003d60| 74 6f 20 62 79 20 64 61 | 74 61 20 66 72 6f 6d 20 |to by da|ta from |
|00003d70| 74 68 65 20 61 63 74 69 | 76 65 20 63 6f 6e 6e 65 |the acti|ve conne|
|00003d80| 63 74 69 6f 6e 20 72 65 | 66 65 72 65 6e 63 65 64 |ction re|ferenced|
|00003d90| 20 62 79 20 73 6f 63 6b | 2e 20 20 73 6f 63 6b 0d | by sock|. sock.|
|00003da0| 6d 75 73 74 20 62 65 20 | 61 20 76 61 6c 69 64 2c |must be |a valid,|
|00003db0| 20 63 6f 6e 6e 65 63 74 | 65 64 20 73 6f 63 6b 65 | connect|ed socke|
|00003dc0| 74 3b 20 20 69 74 20 63 | 61 6e 20 62 65 20 65 69 |t; it c|an be ei|
|00003dd0| 74 68 65 72 20 61 20 54 | 43 50 20 6f 72 20 55 44 |ther a T|CP or UD|
|00003de0| 50 20 73 6f 63 6b 65 74 | 2e 20 20 49 66 0d 74 68 |P socket|. If.th|
|00003df0| 65 72 65 20 69 73 20 6e | 6f 20 64 61 74 61 20 6f |ere is n|o data o|
|00003e00| 75 74 73 74 61 6e 64 69 | 6e 67 2c 20 72 65 61 64 |utstandi|ng, read|
|00003e10| 20 77 69 6c 6c 20 62 6c | 6f 63 6b 20 75 6e 74 69 | will bl|ock unti|
|00003e20| 6c 20 6e 65 77 20 64 61 | 74 61 20 69 73 20 72 65 |l new da|ta is re|
|00003e30| 63 65 69 76 65 64 2e 20 | 72 65 61 64 0d 72 65 74 |ceived. |read.ret|
|00003e40| 75 72 6e 73 20 74 68 65 | 20 6e 75 6d 62 65 72 20 |urns the| number |
|00003e50| 6f 66 20 62 79 74 65 73 | 20 73 75 63 63 65 73 73 |of bytes| success|
|00003e60| 66 75 6c 6c 79 20 72 65 | 61 64 20 66 72 6f 6d 20 |fully re|ad from |
|00003e70| 74 68 65 20 72 65 6d 6f | 74 65 20 68 6f 73 74 3b |the remo|te host;|
|00003e80| 20 69 74 20 72 65 74 75 | 72 6e 73 20 2d 31 0d 69 | it retu|rns -1.i|
|00003e90| 66 20 61 6e 20 65 72 72 | 6f 72 20 70 72 65 76 65 |f an err|or preve|
|00003ea0| 6e 74 73 20 61 6e 79 20 | 64 61 74 61 20 66 72 6f |nts any |data fro|
|00003eb0| 6d 20 62 65 69 6e 67 20 | 72 65 61 64 2e 0d 0d 0d |m being |read....|
|00003ec0| 63 6c 6f 73 65 0d 0d 09 | 69 6e 74 20 63 6c 6f 73 |close...|int clos|
|00003ed0| 65 28 69 6e 74 20 73 6f | 63 6b 29 0d 0d 63 6c 6f |e(int so|ck)..clo|
|00003ee0| 73 65 20 69 73 20 69 64 | 65 6e 74 69 63 61 6c 20 |se is id|entical |
|00003ef0| 74 6f 20 74 68 65 20 55 | 4e 49 58 20 66 75 6e 63 |to the U|NIX func|
|00003f00| 74 69 6f 6e 20 77 69 74 | 68 20 74 68 65 20 73 61 |tion wit|h the sa|
|00003f10| 6d 65 20 6e 61 6d 65 2e | 20 20 63 6c 6f 73 65 20 |me name.| close |
|00003f20| 63 6c 6f 73 65 73 20 61 | 6e 0d 61 63 74 69 76 65 |closes a|n.active|
|00003f30| 20 73 6f 63 6b 65 74 20 | 61 6e 64 20 72 65 6c 65 | socket |and rele|
|00003f40| 61 73 65 73 20 69 74 73 | 20 6d 65 6d 6f 72 79 2e |ases its| memory.|
|00003f50| 20 20 63 6c 6f 73 65 20 | 72 65 74 75 72 6e 73 20 | close |returns |
|00003f60| 30 3b 20 69 74 20 63 61 | 6e 20 72 65 74 75 72 6e |0; it ca|n return|
|00003f70| 20 2d 31 20 69 66 20 61 | 6e 0d 65 72 72 6f 72 20 | -1 if a|n.error |
|00003f80| 6f 63 63 75 72 73 2e 0d | 0d 0d 73 65 6c 65 63 74 |occurs..|..select|
|00003f90| 0d 0d 09 69 6e 74 20 73 | 65 6c 65 63 74 20 28 69 |...int s|elect (i|
|00003fa0| 6e 74 20 6e 66 64 73 2c | 20 75 6e 73 69 67 6e 65 |nt nfds,| unsigne|
|00003fb0| 64 20 6c 6f 6e 67 20 2a | 72 65 61 64 66 73 2c 20 |d long *|readfs, |
|00003fc0| 73 74 72 75 63 74 20 74 | 69 6d 65 76 61 6c 20 2a |struct t|imeval *|
|00003fd0| 74 69 6d 65 6f 75 74 29 | 0d 0d 73 65 6c 65 63 74 |timeout)|..select|
|00003fe0| 20 69 73 20 75 73 65 64 | 20 74 6f 20 66 69 6e 64 | is used| to find|
|00003ff0| 20 6f 75 74 20 69 66 20 | 61 6e 79 20 75 6e 72 65 | out if |any unre|
|00004000| 61 64 20 64 61 74 61 20 | 69 73 20 6f 75 74 73 74 |ad data |is outst|
|00004010| 61 6e 64 69 6e 67 20 6f | 6e 20 61 20 73 6f 63 6b |anding o|n a sock|
|00004020| 65 74 20 62 65 66 6f 72 | 65 0d 62 6c 6f 63 6b 69 |et befor|e.blocki|
|00004030| 6e 67 20 74 68 65 20 70 | 72 6f 63 65 73 73 20 77 |ng the p|rocess w|
|00004040| 69 74 68 20 61 20 72 65 | 61 64 28 29 20 6f 72 20 |ith a re|ad() or |
|00004050| 73 69 6d 69 6c 61 72 20 | 63 61 6c 6c 2e 20 20 54 |similar |call. T|
|00004060| 68 65 20 61 72 67 75 6d | 65 6e 74 20 6c 69 73 74 |he argum|ent list|
|00004070| 20 69 73 20 61 0d 74 72 | 75 6e 63 61 74 65 64 20 | is a.tr|uncated |
|00004080| 76 65 72 73 69 6f 6e 20 | 6f 66 20 74 68 65 20 6f |version |of the o|
|00004090| 72 69 67 69 6e 61 6c 20 | 55 4e 49 58 3b 20 49 27 |riginal |UNIX; I'|
|000040a0| 76 65 20 6b 65 70 74 20 | 6f 6e 6c 79 20 74 68 65 |ve kept |only the|
|000040b0| 20 61 73 70 65 63 74 73 | 20 6f 66 20 74 68 65 20 | aspects| of the |
|000040c0| 63 61 6c 6c 0d 74 68 61 | 74 20 61 72 65 20 69 6d |call.tha|t are im|
|000040d0| 70 6f 72 74 61 6e 74 20 | 74 6f 20 73 6f 63 6b 65 |portant |to socke|
|000040e0| 74 20 70 72 6f 67 72 61 | 6d 6d 65 72 73 20 28 61 |t progra|mmers (a|
|000040f0| 74 20 6c 65 61 73 74 20 | 49 20 62 65 6c 69 65 76 |t least |I believ|
|00004100| 65 20 49 20 68 61 76 65 | 29 2e 0d 0d 6e 66 64 73 |e I have|)...nfds|
|00004110| 20 69 73 20 74 68 65 20 | 6e 75 6d 62 65 72 20 6f | is the |number o|
|00004120| 66 20 66 69 6c 65 20 64 | 65 73 63 72 69 70 74 6f |f file d|escripto|
|00004130| 72 73 20 61 76 61 69 6c | 61 62 6c 65 20 6f 6e 20 |rs avail|able on |
|00004140| 74 68 65 20 73 79 73 74 | 65 6d 2e 20 20 57 68 69 |the syst|em. Whi|
|00004150| 6c 65 20 74 68 69 73 20 | 63 61 6e 0d 76 61 72 79 |le this |can.vary|
|00004160| 20 66 72 6f 6d 20 55 4e | 49 58 20 73 79 73 74 65 | from UN|IX syste|
|00004170| 6d 20 74 6f 20 55 4e 49 | 58 20 73 79 73 74 65 6d |m to UNI|X system|
|00004180| 2c 20 79 6f 75 20 63 61 | 6e 20 63 6f 75 6e 74 20 |, you ca|n count |
|00004190| 6f 6e 20 74 68 65 20 6e | 75 6d 62 65 72 20 6f 66 |on the n|umber of|
|000041a0| 20 66 69 6c 65 0d 64 65 | 73 63 72 69 70 74 6f 72 | file.de|scriptor|
|000041b0| 73 20 6b 6e 6f 77 6e 20 | 62 79 20 53 69 6d 70 6c |s known |by Simpl|
|000041c0| 65 20 53 6f 63 6b 65 74 | 73 20 62 65 69 6e 67 20 |e Socket|s being |
|000041d0| 33 32 20 d1 20 61 73 20 | 64 65 66 69 6e 65 64 20 |32 . as |defined |
|000041e0| 69 6e 20 69 70 2e 68 20 | 61 73 20 6b 4e 75 6d 53 |in ip.h |as kNumS|
|000041f0| 6f 63 6b 65 74 73 2e 0d | 41 6c 77 61 79 73 20 70 |ockets..|Always p|
|00004200| 61 73 73 20 74 68 69 73 | 20 63 6f 6e 73 74 61 6e |ass this| constan|
|00004210| 74 20 69 6e 20 61 73 20 | 6e 66 64 73 2e 0d 0d 2a |t in as |nfds...*|
|00004220| 72 65 61 64 66 73 20 73 | 70 65 63 69 66 69 65 73 |readfs s|pecifies|
|00004230| 20 74 68 65 20 73 6f 63 | 6b 65 74 73 20 6f 6e 65 | the soc|kets one|
|00004240| 20 77 61 6e 74 73 20 74 | 6f 20 71 75 65 72 79 2e | wants t|o query.|
|00004250| 20 20 49 74 20 69 73 20 | 6e 6f 20 63 6f 69 6e 63 | It is |no coinc|
|00004260| 69 64 65 6e 63 65 20 74 | 68 61 74 0d 77 68 69 6c |idence t|hat.whil|
|00004270| 65 20 74 68 65 72 65 20 | 61 72 65 20 33 32 20 73 |e there |are 32 s|
|00004280| 6f 63 6b 65 74 20 64 65 | 73 63 72 69 70 74 6f 72 |ocket de|scriptor|
|00004290| 73 20 69 6e 20 53 69 6d | 70 6c 65 20 53 6f 63 6b |s in Sim|ple Sock|
|000042a0| 65 74 73 2c 20 74 68 65 | 72 65 20 61 72 65 20 33 |ets, the|re are 3|
|000042b0| 32 20 62 69 74 73 20 69 | 6e 20 61 6e 0d 75 6e 73 |2 bits i|n an.uns|
|000042c0| 69 67 6e 65 64 20 6c 6f | 6e 67 20 6e 75 6d 62 65 |igned lo|ng numbe|
|000042d0| 72 2e 20 20 54 6f 20 73 | 70 65 63 69 66 79 20 61 |r. To s|pecify a|
|000042e0| 20 70 61 72 74 69 63 75 | 6c 61 72 20 73 6f 63 6b | particu|lar sock|
|000042f0| 65 74 2c 20 73 65 74 20 | 69 74 27 73 20 63 6f 72 |et, set |it's cor|
|00004300| 72 65 73 70 6f 6e 64 69 | 6e 67 20 62 69 74 0d 74 |respondi|ng bit.t|
|00004310| 6f 20 31 3b 20 73 65 74 | 20 61 6c 6c 20 6f 74 68 |o 1; set| all oth|
|00004320| 65 72 20 62 69 74 73 20 | 74 6f 20 30 2e 20 20 57 |er bits |to 0. W|
|00004330| 68 65 6e 20 73 65 6c 65 | 63 74 20 72 65 74 75 72 |hen sele|ct retur|
|00004340| 6e 73 2c 20 2a 72 65 61 | 64 66 73 20 69 64 65 6e |ns, *rea|dfs iden|
|00004350| 74 69 66 69 65 73 20 73 | 6f 63 6b 65 74 73 0d 77 |tifies s|ockets.w|
|00004360| 69 74 68 20 69 6e 63 6f | 6d 6d 69 6e 67 20 64 61 |ith inco|mming da|
|00004370| 74 61 20 6f 75 74 73 74 | 61 6e 64 69 6e 67 20 69 |ta outst|anding i|
|00004380| 6e 20 74 68 65 20 73 61 | 6d 65 20 77 61 79 2e 0d |n the sa|me way..|
|00004390| 0d 4f 6e 65 20 63 61 6e | 20 73 70 65 63 69 66 79 |.One can| specify|
|000043a0| 20 61 20 6c 65 6e 67 74 | 68 20 6f 66 20 74 69 6d | a lengt|h of tim|
|000043b0| 65 20 74 6f 20 77 61 69 | 74 20 66 6f 72 20 76 69 |e to wai|t for vi|
|000043c0| 61 20 2a 74 69 6d 65 6f | 75 74 2e 20 20 49 66 20 |a *timeo|ut. If |
|000043d0| 2a 74 69 6d 65 6f 75 74 | 20 69 73 20 6e 69 6c 2c |*timeout| is nil,|
|000043e0| 0d 73 65 6c 65 63 74 20 | 77 69 6c 6c 20 70 6f 6c |.select |will pol|
|000043f0| 6c 20 6f 6e 63 65 20 62 | 65 66 6f 72 65 20 72 65 |l once b|efore re|
|00004400| 74 75 72 6e 69 6e 67 2c | 20 77 68 65 74 68 65 72 |turning,| whether|
|00004410| 20 6f 72 20 6e 6f 74 20 | 74 68 65 72 65 20 69 73 | or not |there is|
|00004420| 20 75 6e 72 65 61 64 20 | 64 61 74 61 2e 20 20 49 | unread |data. I|
|00004430| 66 0d 2a 74 69 6d 65 6f | 75 74 20 69 73 20 6e 6f |f.*timeo|ut is no|
|00004440| 74 20 6e 69 6c 2c 20 69 | 74 73 20 66 69 65 6c 64 |t nil, i|ts field|
|00004450| 73 20 64 65 73 63 72 69 | 62 65 20 74 68 65 20 6d |s descri|be the m|
|00004460| 61 78 69 6d 75 6d 20 61 | 6d 6f 75 6e 74 20 6f 66 |aximum a|mount of|
|00004470| 20 74 69 6d 65 20 73 65 | 6c 65 63 74 20 73 68 6f | time se|lect sho|
|00004480| 75 6c 64 0d 77 61 69 74 | 20 62 65 66 6f 72 65 20 |uld.wait| before |
|00004490| 67 69 76 69 6e 67 20 75 | 70 20 61 6e 64 20 72 65 |giving u|p and re|
|000044a0| 74 75 72 6e 69 6e 67 20 | 74 6f 20 74 68 65 20 70 |turning |to the p|
|000044b0| 72 6f 67 72 61 6d 2e 0d | 0d 49 6e 20 61 64 64 69 |rogram..|.In addi|
|000044c0| 74 69 6f 6e 20 74 6f 20 | 72 65 74 75 72 6e 69 6e |tion to |returnin|
|000044d0| 67 20 64 61 74 61 20 76 | 69 61 20 2a 72 65 61 64 |g data v|ia *read|
|000044e0| 66 73 2c 20 73 65 6c 65 | 63 74 20 69 74 73 65 6c |fs, sele|ct itsel|
|000044f0| 66 20 72 65 74 75 72 6e | 73 20 61 6e 20 69 6e 74 |f return|s an int|
|00004500| 65 67 65 72 20 66 6f 72 | 0d 65 72 72 6f 72 20 64 |eger for|.error d|
|00004510| 65 74 65 63 74 69 6f 6e | 2e 20 20 41 20 72 65 74 |etection|. A ret|
|00004520| 75 72 6e 20 76 61 6c 75 | 65 20 6f 66 20 30 20 69 |urn valu|e of 0 i|
|00004530| 6e 64 69 63 61 74 65 73 | 20 73 75 63 63 65 73 73 |ndicates| success|
|00004540| 2c 20 2d 31 20 69 6e 64 | 69 63 61 74 65 73 20 66 |, -1 ind|icates f|
|00004550| 61 69 6c 75 72 65 2e 0d | 53 69 6d 70 6c 65 20 53 |ailure..|Simple S|
|00004560| 6f 63 6b 65 74 27 73 20 | 73 65 6c 65 63 74 20 77 |ocket's |select w|
|00004570| 69 6c 6c 20 6f 6e 6c 79 | 20 72 65 74 75 72 6e 20 |ill only| return |
|00004580| 61 6e 20 65 72 72 6f 72 | 20 69 66 20 61 20 73 6f |an error| if a so|
|00004590| 63 6b 65 74 20 77 61 73 | 20 66 6c 61 67 67 65 64 |cket was| flagged|
|000045a0| 20 74 68 61 74 20 69 73 | 0d 6e 6f 74 20 61 6e 20 | that is|.not an |
|000045b0| 69 6e 69 74 69 61 6c 69 | 7a 65 64 20 73 6f 63 6b |initiali|zed sock|
|000045c0| 65 74 2e 0d 0d 73 65 6c | 65 63 74 20 69 73 20 72 |et...sel|ect is r|
|000045d0| 65 61 6c 6c 79 20 75 73 | 65 64 20 62 79 20 61 64 |eally us|ed by ad|
|000045e0| 76 61 6e 63 65 64 20 73 | 6f 63 6b 65 74 20 70 72 |vanced s|ocket pr|
|000045f0| 6f 67 72 61 6d 6d 65 72 | 73 20 d1 20 69 74 27 73 |ogrammer|s . it's|
|00004600| 20 6e 6f 74 20 72 65 61 | 6c 6c 79 20 73 6f 6d 65 | not rea|lly some|
|00004610| 74 68 69 6e 67 0d 49 20 | 77 6f 75 6c 64 20 65 78 |thing.I |would ex|
|00004620| 70 65 63 74 20 61 20 6e | 6f 76 69 63 65 20 74 6f |pect a n|ovice to|
|00004630| 20 75 6e 64 65 72 73 74 | 61 6e 64 20 6a 75 73 74 | underst|and just|
|00004640| 20 66 72 6f 6d 20 72 65 | 61 64 69 6e 67 20 74 68 | from re|ading th|
|00004650| 69 73 20 66 69 6c 65 2e | 20 20 46 6f 72 20 6d 6f |is file.| For mo|
|00004660| 72 65 0d 65 6e 6c 69 67 | 68 74 65 6e 6d 65 6e 74 |re.enlig|htenment|
|00004670| 2c 20 49 20 6d 75 73 74 | 20 72 65 66 65 72 20 79 |, I must| refer y|
|00004680| 6f 75 20 74 6f 20 6d 79 | 20 22 53 75 67 67 65 73 |ou to my| "Sugges|
|00004690| 74 65 64 20 52 65 61 64 | 69 6e 67 20 4c 69 73 74 |ted Read|ing List|
|000046a0| 22 20 28 73 65 63 74 69 | 6f 6e 20 38 29 2e 0d 0d |" (secti|on 8)...|
|000046b0| 4e 6f 74 65 3a 20 49 6e | 20 74 68 65 20 73 6f 75 |Note: In| the sou|
|000046c0| 72 63 65 20 66 69 6c 65 | 20 69 70 2e 63 2c 20 73 |rce file| ip.c, s|
|000046d0| 65 6c 65 63 74 20 69 73 | 20 69 6e 20 61 20 73 65 |elect is| in a se|
|000046e0| 63 74 69 6f 6e 20 6f 66 | 20 63 6f 64 65 20 6c 61 |ction of| code la|
|000046f0| 62 65 6c 65 64 20 22 54 | 43 50 0d 53 45 43 54 49 |beled "T|CP.SECTI|
|00004700| 4f 4e 22 2e 20 20 54 68 | 69 73 20 69 73 20 69 6e |ON". Th|is is in|
|00004710| 20 65 72 72 6f 72 3b 20 | 73 65 6c 65 63 74 20 64 | error; |select d|
|00004720| 6f 65 73 20 69 6e 66 61 | 63 74 20 77 6f 72 6b 20 |oes infa|ct work |
|00004730| 77 69 74 68 20 54 43 50 | 20 61 6e 64 20 55 44 50 |with TCP| and UDP|
|00004740| 20 73 6f 63 6b 65 74 73 | 2e 0d 0d 0d 54 43 50 20 | sockets|....TCP |
|00004750| 52 4f 55 54 49 4e 45 53 | 0d 0d 0d 61 63 63 65 70 |ROUTINES|...accep|
|00004760| 74 0d 0d 09 69 6e 74 20 | 61 63 63 65 70 74 20 28 |t...int |accept (|
|00004770| 69 6e 74 20 73 6f 63 6b | 2c 20 73 74 72 75 63 74 |int sock|, struct|
|00004780| 20 73 6f 63 6b 61 64 64 | 72 5f 69 6e 20 2a 73 69 | sockadd|r_in *si|
|00004790| 6e 2c 20 69 6e 74 20 2a | 61 6c 65 6e 29 0d 0d 61 |n, int *|alen)..a|
|000047a0| 63 63 65 70 74 20 72 6f | 75 67 68 6c 79 20 65 6d |ccept ro|ughly em|
|000047b0| 75 6c 61 74 65 73 20 74 | 68 65 20 55 4e 49 58 20 |ulates t|he UNIX |
|000047c0| 72 6f 75 74 69 6e 65 20 | 62 79 20 74 68 65 20 73 |routine |by the s|
|000047d0| 61 6d 65 20 6e 61 6d 65 | 2e 20 20 61 63 63 65 70 |ame name|. accep|
|000047e0| 74 20 70 61 73 73 69 76 | 65 6c 79 0d 77 61 69 74 |t passiv|ely.wait|
|000047f0| 73 20 66 6f 72 20 61 20 | 54 43 50 20 63 6f 6e 6e |s for a |TCP conn|
|00004800| 65 63 74 69 6f 6e 20 6f | 6e 20 73 6f 63 6b 65 74 |ection o|n socket|
|00004810| 20 73 6f 63 6b 2e 20 20 | 57 68 65 6e 20 61 20 72 | sock. |When a r|
|00004820| 65 6d 6f 74 65 20 63 6c | 69 65 6e 74 20 63 6f 6e |emote cl|ient con|
|00004830| 6e 65 63 74 73 20 74 6f | 20 74 68 65 0d 6c 6f 63 |nects to| the.loc|
|00004840| 61 6c 20 70 6f 72 74 20 | 64 65 73 63 72 69 62 65 |al port |describe|
|00004850| 64 20 69 6e 20 73 6f 63 | 6b 2c 20 61 63 63 65 70 |d in soc|k, accep|
|00004860| 74 20 72 65 74 75 72 6e | 73 20 61 20 73 6f 63 6b |t return|s a sock|
|00004870| 65 74 20 6e 75 6d 62 65 | 72 20 64 65 73 63 72 69 |et numbe|r descri|
|00004880| 62 69 6e 67 20 74 68 65 | 20 6c 6f 63 61 6c 0d 63 |bing the| local.c|
|00004890| 6f 6e 6e 65 63 74 69 6f | 6e 2c 20 61 6e 64 20 2a |onnectio|n, and *|
|000048a0| 73 69 6e 20 63 6f 6e 74 | 61 69 6e 73 20 74 68 65 |sin cont|ains the|
|000048b0| 20 61 64 64 72 65 73 73 | 20 61 6e 64 20 70 6f 72 | address| and por|
|000048c0| 74 20 6f 66 20 74 68 65 | 20 63 6c 69 65 6e 74 2e |t of the| client.|
|000048d0| 20 20 43 6f 6e 66 75 73 | 65 64 3f 0d 50 6c 65 61 | Confus|ed?.Plea|
|000048e0| 73 65 20 63 6f 6e 73 75 | 6c 74 20 43 6f 6d 65 72 |se consu|lt Comer|
|000048f0| 20 61 6e 64 20 6f 74 68 | 65 72 20 55 4e 49 58 20 | and oth|er UNIX |
|00004900| 74 65 78 74 73 2e 0d 0d | 4e 6f 74 65 3a 20 73 69 |texts...|Note: si|
|00004910| 6e 20 69 73 20 61 20 73 | 74 72 75 63 74 20 73 6f |n is a s|truct so|
|00004920| 63 6b 61 64 64 72 5f 69 | 6e 20 2a 20 72 61 74 68 |ckaddr_i|n * rath|
|00004930| 65 72 20 74 68 61 6e 20 | 61 20 73 74 72 75 63 74 |er than |a struct|
|00004940| 20 73 6f 63 6b 61 64 64 | 72 20 2a 2e 20 41 6c 73 | sockadd|r *. Als|
|00004950| 6f 20 74 68 65 0d 76 61 | 72 69 61 62 6c 65 20 61 |o the.va|riable a|
|00004960| 6c 65 6e 20 69 73 20 6e | 6f 74 20 75 73 65 64 2c |len is n|ot used,|
|00004970| 20 69 74 20 69 73 20 70 | 72 6f 76 69 64 65 64 20 | it is p|rovided |
|00004980| 73 6f 6c 65 6c 79 20 66 | 6f 72 20 63 6f 6d 70 61 |solely f|or compa|
|00004990| 74 69 62 69 6c 69 74 79 | 20 77 69 74 68 20 55 4e |tibility| with UN|
|000049a0| 49 58 0d 63 6f 64 65 2e | 0d 0d 0d 55 44 50 20 52 |IX.code.|...UDP R|
|000049b0| 4f 55 54 49 4e 45 53 0d | 0d 0d 72 65 63 76 66 72 |OUTINES.|..recvfr|
|000049c0| 6f 6d 0d 0d 09 69 6e 74 | 20 72 65 63 76 66 72 6f |om...int| recvfro|
|000049d0| 6d 20 28 69 6e 74 20 73 | 6f 63 6b 2c 20 63 68 61 |m (int s|ock, cha|
|000049e0| 72 20 2a 62 75 66 2c 20 | 69 6e 74 20 6c 65 6e 2c |r *buf, |int len,|
|000049f0| 20 69 6e 74 20 66 6c 61 | 67 73 2c 20 0d 09 09 09 | int fla|gs, ....|
|00004a00| 20 20 20 20 20 20 73 74 | 72 75 63 74 20 73 6f 63 | st|ruct soc|
|00004a10| 6b 61 64 64 72 5f 69 6e | 20 2a 73 69 6e 2c 20 69 |kaddr_in| *sin, i|
|00004a20| 6e 74 20 2a 61 6c 65 6e | 29 0d 0d 72 65 63 76 66 |nt *alen|)..recvf|
|00004a30| 72 6f 6d 20 72 6f 75 67 | 68 6c 79 20 65 6d 75 6c |rom roug|hly emul|
|00004a40| 61 74 65 73 20 74 68 65 | 20 55 4e 49 58 20 72 6f |ates the| UNIX ro|
|00004a50| 75 74 69 6e 65 20 62 79 | 20 74 68 65 20 73 61 6d |utine by| the sam|
|00004a60| 65 20 6e 61 6d 65 2e 20 | 20 49 74 20 61 6c 6c 6f |e name. | It allo|
|00004a70| 77 73 20 61 20 70 72 6f | 67 72 61 6d 0d 74 6f 20 |ws a pro|gram.to |
|00004a80| 70 61 73 73 69 76 65 6c | 79 20 77 61 69 74 20 66 |passivel|y wait f|
|00004a90| 6f 72 20 55 44 50 20 73 | 6f 63 6b 65 74 20 69 6e |or UDP s|ocket in|
|00004aa0| 66 6f 72 6d 61 74 69 6f | 6e 2e 20 20 73 6f 63 6b |formatio|n. sock|
|00004ab0| 20 69 73 20 61 20 76 61 | 6c 69 64 20 55 44 50 20 | is a va|lid UDP |
|00004ac0| 73 6f 63 6b 65 74 2c 20 | 62 75 66 0d 70 6f 69 6e |socket, |buf.poin|
|00004ad0| 74 73 20 74 6f 20 61 20 | 6e 75 6d 62 65 72 20 6f |ts to a |number o|
|00004ae0| 66 20 62 79 74 65 73 20 | 69 6e 20 6d 65 6d 6f 72 |f bytes |in memor|
|00004af0| 79 2c 20 6c 65 6e 20 69 | 73 20 74 68 65 20 73 69 |y, len i|s the si|
|00004b00| 7a 65 20 6f 66 20 6d 65 | 6d 6f 72 79 20 70 6f 69 |ze of me|mory poi|
|00004b10| 6e 74 65 64 20 74 6f 20 | 62 79 0d 62 75 66 2c 20 |nted to |by.buf, |
|00004b20| 61 6e 64 20 2a 73 69 6e | 20 63 6f 6e 74 61 69 6e |and *sin| contain|
|00004b30| 73 20 74 68 65 20 61 64 | 64 72 65 73 73 20 61 6e |s the ad|dress an|
|00004b40| 64 20 70 6f 72 74 20 6f | 66 20 74 68 65 20 63 6c |d port o|f the cl|
|00004b50| 69 65 6e 74 20 75 70 6f | 6e 20 72 65 74 75 72 6e |ient upo|n return|
|00004b60| 2e 20 20 49 66 20 2a 73 | 69 6e 20 0d 69 73 20 6e |. If *s|in .is n|
|00004b70| 69 6c 2c 20 70 61 63 6b | 65 74 73 20 77 69 6c 6c |il, pack|ets will|
|00004b80| 20 62 65 20 61 63 63 65 | 70 74 65 64 20 66 72 6f | be acce|pted fro|
|00004b90| 6d 20 61 6e 79 20 63 6c | 69 65 6e 74 2e 0d 0d 4e |m any cl|ient...N|
|00004ba0| 6f 74 65 3a 20 73 69 6e | 20 69 73 20 61 20 73 74 |ote: sin| is a st|
|00004bb0| 72 75 63 74 20 73 6f 63 | 6b 61 64 64 72 5f 69 6e |ruct soc|kaddr_in|
|00004bc0| 20 2a 20 72 61 74 68 65 | 72 20 74 68 61 6e 20 61 | * rathe|r than a|
|00004bd0| 20 73 74 72 75 63 74 20 | 73 6f 63 6b 61 64 64 72 | struct |sockaddr|
|00004be0| 20 2a 2e 20 41 6c 73 6f | 20 74 68 65 0d 76 61 72 | *. Also| the.var|
|00004bf0| 69 61 62 6c 65 73 20 61 | 6c 65 6e 20 61 6e 64 20 |iables a|len and |
|00004c00| 66 6c 61 67 73 20 61 72 | 65 20 6e 6f 74 20 75 73 |flags ar|e not us|
|00004c10| 65 64 2c 20 74 68 65 79 | 20 61 72 65 20 70 72 6f |ed, they| are pro|
|00004c20| 76 69 64 65 64 20 73 6f | 6c 65 6c 79 20 66 6f 72 |vided so|lely for|
|00004c30| 20 63 6f 6d 70 61 74 69 | 62 69 6c 69 74 79 0d 77 | compati|bility.w|
|00004c40| 69 74 68 20 55 4e 49 58 | 20 63 6f 64 65 2e 0d 0d |ith UNIX| code...|
|00004c50| 0d 73 65 6e 64 74 6f 0d | 0d 09 69 6e 74 20 73 65 |.sendto.|..int se|
|00004c60| 6e 64 74 6f 20 28 69 6e | 74 20 73 6f 63 6b 2c 20 |ndto (in|t sock, |
|00004c70| 63 68 61 72 20 2a 64 61 | 74 61 2c 20 69 6e 74 20 |char *da|ta, int |
|00004c80| 6c 65 6e 2c 20 69 6e 74 | 20 66 6c 61 67 73 2c 20 |len, int| flags, |
|00004c90| 0d 09 09 09 09 73 74 72 | 75 63 74 20 73 6f 63 6b |.....str|uct sock|
|00004ca0| 61 64 64 72 5f 69 6e 20 | 2a 73 69 6e 2c 20 69 6e |addr_in |*sin, in|
|00004cb0| 74 20 61 6c 65 6e 29 0d | 0d 73 65 6e 64 74 6f 20 |t alen).|.sendto |
|00004cc0| 72 6f 75 67 68 6c 79 20 | 65 6d 75 6c 61 74 65 73 |roughly |emulates|
|00004cd0| 20 74 68 65 20 55 4e 49 | 58 20 72 6f 75 74 69 6e | the UNI|X routin|
|00004ce0| 65 20 62 79 20 74 68 65 | 20 73 61 6d 65 20 6e 61 |e by the| same na|
|00004cf0| 6d 65 2e 20 20 49 74 20 | 61 6c 6c 6f 77 73 20 61 |me. It |allows a|
|00004d00| 20 70 72 6f 67 72 61 6d | 0d 74 6f 20 73 65 6e 64 | program|.to send|
|00004d10| 20 64 61 74 61 20 61 63 | 72 6f 73 73 20 61 20 55 | data ac|ross a U|
|00004d20| 44 50 20 73 74 72 65 61 | 6d 2e 20 20 73 6f 63 6b |DP strea|m. sock|
|00004d30| 20 69 73 20 61 20 76 61 | 6c 69 64 20 55 44 50 20 | is a va|lid UDP |
|00004d40| 73 6f 63 6b 65 74 2c 20 | 64 61 74 61 20 70 6f 69 |socket, |data poi|
|00004d50| 6e 74 73 20 74 6f 20 61 | 0d 6e 75 6d 62 65 72 20 |nts to a|.number |
|00004d60| 6f 66 20 62 79 74 65 73 | 20 69 6e 20 6d 65 6d 6f |of bytes| in memo|
|00004d70| 72 79 2c 20 6c 65 6e 20 | 69 73 20 74 68 65 20 73 |ry, len |is the s|
|00004d80| 69 7a 65 20 6f 66 20 6d | 65 6d 6f 72 79 20 70 6f |ize of m|emory po|
|00004d90| 69 6e 74 65 64 20 74 6f | 20 62 79 20 64 61 74 61 |inted to| by data|
|00004da0| 2c 20 61 6e 64 20 2a 73 | 69 6e 0d 63 6f 6e 74 61 |, and *s|in.conta|
|00004db0| 69 6e 73 20 74 68 65 20 | 61 64 64 72 65 73 73 20 |ins the |address |
|00004dc0| 61 6e 64 20 70 6f 72 74 | 20 6f 66 20 74 68 65 20 |and port| of the |
|00004dd0| 73 65 72 76 65 72 2e 0d | 0d 4e 6f 74 65 3a 20 73 |server..|.Note: s|
|00004de0| 69 6e 20 69 73 20 61 20 | 73 74 72 75 63 74 20 73 |in is a |struct s|
|00004df0| 6f 63 6b 61 64 64 72 5f | 69 6e 20 2a 20 72 61 74 |ockaddr_|in * rat|
|00004e00| 68 65 72 20 74 68 61 6e | 20 61 20 73 74 72 75 63 |her than| a struc|
|00004e10| 74 20 73 6f 63 6b 61 64 | 64 72 20 2a 2e 20 41 6c |t sockad|dr *. Al|
|00004e20| 73 6f 20 74 68 65 0d 76 | 61 72 69 61 62 6c 65 73 |so the.v|ariables|
|00004e30| 20 61 6c 65 6e 20 61 6e | 64 20 66 6c 61 67 73 20 | alen an|d flags |
|00004e40| 61 72 65 20 6e 6f 74 20 | 75 73 65 64 2c 20 74 68 |are not |used, th|
|00004e50| 65 79 20 61 72 65 20 70 | 72 6f 76 69 64 65 64 20 |ey are p|rovided |
|00004e60| 73 6f 6c 65 6c 79 20 66 | 6f 72 20 63 6f 6d 70 61 |solely f|or compa|
|00004e70| 74 69 62 69 6c 69 74 79 | 0d 77 69 74 68 20 55 4e |tibility|.with UN|
|00004e80| 49 58 20 63 6f 64 65 2e | 0d 0d 0d 44 41 54 41 20 |IX code.|...DATA |
|00004e90| 52 45 50 52 45 53 45 4e | 54 41 54 49 4f 4e 20 28 |REPRESEN|TATION (|
|00004ea0| 69 70 64 72 2e 63 29 0d | 0d 0d 09 69 6e 74 20 68 |ipdr.c).|...int h|
|00004eb0| 74 6f 6e 73 28 69 6e 74 | 20 78 29 0d 09 69 6e 74 |tons(int| x)..int|
|00004ec0| 20 6e 74 6f 68 73 28 69 | 6e 74 20 78 29 0d 09 6c | ntohs(i|nt x)..l|
|00004ed0| 6f 6e 67 20 68 74 6f 6e | 6c 28 6c 6f 6e 67 20 79 |ong hton|l(long y|
|00004ee0| 29 0d 09 6c 6f 6e 67 20 | 6e 74 6f 68 6c 28 6c 6f |)..long |ntohl(lo|
|00004ef0| 6e 67 20 79 29 0d 0d 54 | 68 65 73 65 20 72 6f 75 |ng y)..T|hese rou|
|00004f00| 74 69 6e 65 73 20 61 72 | 65 20 70 72 6f 76 69 64 |tines ar|e provid|
|00004f10| 65 64 20 66 6f 72 20 55 | 4e 49 58 20 63 6f 6d 70 |ed for U|NIX comp|
|00004f20| 61 74 69 62 69 6c 69 74 | 79 2e 20 20 53 69 6e 63 |atibilit|y. Sinc|
|00004f30| 65 20 74 68 65 20 4d 61 | 63 69 6e 74 6f 73 68 20 |e the Ma|cintosh |
|00004f40| 62 79 74 65 0d 6f 72 64 | 65 72 69 6e 67 20 69 73 |byte.ord|ering is|
|00004f50| 20 69 64 65 6e 74 69 63 | 61 6c 20 74 6f 20 22 4e | identic|al to "N|
|00004f60| 65 74 77 6f 72 6b 20 62 | 79 74 65 20 6f 72 64 65 |etwork b|yte orde|
|00004f70| 72 69 6e 67 22 20 74 68 | 65 73 65 20 72 6f 75 74 |ring" th|ese rout|
|00004f80| 69 6e 65 73 20 64 6f 20 | 6e 6f 74 68 69 6e 67 2e |ines do |nothing.|
|00004f90| 20 54 68 65 79 0d 73 69 | 6d 70 6c 79 20 72 65 74 | They.si|mply ret|
|00004fa0| 75 72 6e 20 74 68 65 69 | 72 20 61 72 67 75 6d 65 |urn thei|r argume|
|00004fb0| 6e 74 73 2e 0d 0d 0d 36 | 2e 20 4d 61 6b 69 6e 67 |nts....6|. Making|
|00004fc0| 20 59 6f 75 72 20 4f 77 | 6e 20 53 70 69 6e 20 52 | Your Ow|n Spin R|
|00004fd0| 6f 75 74 69 6e 65 73 0d | 7e 7e 7e 7e 7e 7e 7e 7e |outines.|~~~~~~~~|
|00004fe0| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00004ff0| 7e 7e 7e 7e 7e 7e 7e 7e | 0d 0d 53 70 69 6e 20 52 |~~~~~~~~|..Spin R|
|00005000| 6f 75 74 69 6e 65 73 20 | 70 72 6f 76 69 64 65 20 |outines |provide |
|00005010| 73 69 6d 70 6c 65 20 65 | 76 65 6e 74 20 70 72 6f |simple e|vent pro|
|00005020| 63 65 73 73 69 6e 67 2c | 20 61 6c 6c 6f 77 69 6e |cessing,| allowin|
|00005030| 67 20 74 68 65 20 4d 61 | 63 69 6e 74 6f 73 68 20 |g the Ma|cintosh |
|00005040| 74 6f 20 63 6f 6e 74 69 | 6e 75 65 0d 6d 75 6c 74 |to conti|nue.mult|
|00005050| 69 2d 74 61 73 6b 69 6e | 67 20 77 68 69 6c 65 20 |i-taskin|g while |
|00005060| 77 61 69 74 69 6e 67 20 | 66 6f 72 20 61 20 4d 61 |waiting |for a Ma|
|00005070| 63 54 43 50 20 63 61 6c | 6c 20 74 6f 20 72 65 74 |cTCP cal|l to ret|
|00005080| 75 72 6e 2e 20 20 52 61 | 74 68 65 72 20 74 68 61 |urn. Ra|ther tha|
|00005090| 6e 20 70 72 6f 63 65 73 | 73 69 6e 67 0d 65 76 65 |n proces|sing.eve|
|000050a0| 6e 74 73 20 69 6e 20 61 | 6e 20 65 76 65 6e 74 20 |nts in a|n event |
|000050b0| 6c 6f 6f 70 2c 20 53 70 | 69 6e 20 52 6f 75 74 69 |loop, Sp|in Routi|
|000050c0| 6e 65 73 20 73 68 6f 75 | 6c 64 20 70 72 6f 63 65 |nes shou|ld proce|
|000050d0| 73 73 20 6f 6e 6c 79 20 | 61 20 66 65 77 20 65 76 |ss only |a few ev|
|000050e0| 65 6e 74 73 20 61 74 20 | 61 20 74 69 6d 65 0d 62 |ents at |a time.b|
|000050f0| 65 66 6f 72 65 20 72 65 | 74 75 72 6e 69 6e 67 2e |efore re|turning.|
|00005100| 0d 0d 41 20 53 70 69 6e | 20 52 6f 75 74 69 6e 65 |..A Spin| Routine|
|00005110| 20 68 61 73 20 74 68 65 | 20 66 6f 6c 6c 6f 77 69 | has the| followi|
|00005120| 6e 67 20 68 65 61 64 65 | 72 3a 0d 0d 09 4f 53 45 |ng heade|r:...OSE|
|00005130| 72 72 20 4d 79 53 70 69 | 6e 52 6f 75 74 69 6e 65 |rr MySpi|nRoutine|
|00005140| 20 28 76 6f 69 64 29 0d | 09 0d 4e 6f 74 65 3a 20 | (void).|..Note: |
|00005150| 20 42 65 63 61 75 73 65 | 20 74 68 65 20 72 6f 75 | Because| the rou|
|00005160| 74 69 6e 65 20 77 69 6c | 6c 20 62 65 20 63 61 6c |tine wil|l be cal|
|00005170| 6c 65 64 20 62 79 20 74 | 68 65 20 53 69 6d 70 6c |led by t|he Simpl|
|00005180| 65 20 53 6f 63 6b 65 74 | 73 20 6c 69 62 72 61 72 |e Socket|s librar|
|00005190| 79 20 61 6e 64 20 6e 6f | 74 0d 62 79 20 74 68 65 |y and no|t.by the|
|000051a0| 20 4d 61 63 69 6e 74 6f | 73 68 20 6f 70 65 72 61 | Macinto|sh opera|
|000051b0| 74 69 6e 67 20 73 79 73 | 74 65 6d 2c 20 69 74 20 |ting sys|tem, it |
|000051c0| 73 68 6f 75 6c 64 6e 27 | 74 20 62 65 20 70 72 65 |shouldn'|t be pre|
|000051d0| 66 69 78 65 64 20 77 69 | 74 68 20 74 68 65 20 22 |fixed wi|th the "|
|000051e0| 70 61 73 63 61 6c 22 0d | 6b 65 79 77 6f 72 64 2e |pascal".|keyword.|
|000051f0| 0d 0d 54 68 65 73 65 20 | 72 6f 75 74 69 6e 65 73 |..These |routines|
|00005200| 20 63 61 6e 20 62 65 20 | 75 73 65 64 20 74 6f 20 | can be |used to |
|00005210| 70 6f 6c 6c 20 66 6f 72 | 20 75 73 65 72 20 69 6e |poll for| user in|
|00005220| 70 75 74 20 65 76 65 6e | 20 77 68 69 6c 65 20 74 |put even| while t|
|00005230| 68 65 20 70 72 6f 67 72 | 61 6d 20 69 73 0d 77 61 |he progr|am is.wa|
|00005240| 69 74 69 6e 67 20 66 6f | 72 20 61 20 4d 61 63 54 |iting fo|r a MacT|
|00005250| 43 50 20 63 61 6c 6c 20 | 74 6f 20 72 65 74 75 72 |CP call |to retur|
|00005260| 6e 2e 20 20 46 6f 72 20 | 65 78 61 6d 70 6c 65 2c |n. For |example,|
|00005270| 20 74 68 65 20 64 65 66 | 61 75 6c 74 20 73 70 69 | the def|ault spi|
|00005280| 6e 20 72 6f 75 74 69 6e | 65 0d 70 72 6f 76 69 64 |n routin|e.provid|
|00005290| 65 64 20 62 79 20 53 69 | 6d 70 6c 65 20 53 6f 63 |ed by Si|mple Soc|
|000052a0| 6b 65 74 73 20 61 6c 6c | 6f 77 73 20 74 68 65 20 |kets all|ows the |
|000052b0| 75 73 65 72 20 74 6f 20 | 70 72 65 73 73 20 22 65 |user to |press "e|
|000052c0| 73 63 22 2c 20 77 68 69 | 63 68 20 77 69 6c 6c 20 |sc", whi|ch will |
|000052d0| 63 61 75 73 65 20 74 68 | 65 0d 63 75 72 72 65 6e |cause th|e.curren|
|000052e0| 74 20 4d 61 63 54 43 50 | 20 63 61 6c 6c 20 74 6f |t MacTCP| call to|
|000052f0| 20 66 61 69 6c 2e 20 20 | 4f 6e 65 20 63 6f 75 6c | fail. |One coul|
|00005300| 64 20 65 61 73 69 6c 79 | 20 63 72 65 61 74 65 20 |d easily| create |
|00005310| 61 20 77 69 6e 64 6f 77 | 20 77 69 74 68 20 61 20 |a window| with a |
|00005320| 43 61 6e 63 65 6c 0d 62 | 75 74 74 6f 6e 2c 20 6d |Cancel.b|utton, m|
|00005330| 61 6b 65 20 61 20 73 6f | 63 6b 65 74 20 63 61 6c |ake a so|cket cal|
|00005340| 6c 2c 20 61 6e 64 20 75 | 73 65 20 61 20 63 75 73 |l, and u|se a cus|
|00005350| 74 6f 6d 20 53 70 69 6e | 20 52 6f 75 74 69 6e 65 |tom Spin| Routine|
|00005360| 20 74 6f 20 68 61 6e 64 | 6c 65 20 74 68 61 74 20 | to hand|le that |
|00005370| 62 75 74 74 6f 6e 2e 0d | 0d 46 6f 72 20 61 6e 20 |button..|.For an |
|00005380| 65 78 61 6d 70 6c 65 20 | 53 70 69 6e 20 52 6f 75 |example |Spin Rou|
|00005390| 74 69 6e 65 2c 20 73 65 | 65 20 74 68 65 20 66 69 |tine, se|e the fi|
|000053a0| 6c 65 20 69 70 6c 6f 77 | 2e 63 3b 20 74 68 65 20 |le iplow|.c; the |
|000053b0| 64 65 66 61 75 6c 74 20 | 73 70 69 6e 20 72 6f 75 |default |spin rou|
|000053c0| 74 69 6e 65 20 69 73 0d | 6e 61 6d 65 64 20 22 53 |tine is.|named "S|
|000053d0| 70 69 6e 44 65 66 61 75 | 6c 74 22 2e 0d 0d 0d 37 |pinDefau|lt"....7|
|000053e0| 2e 20 20 45 72 72 6f 72 | 20 48 61 6e 64 6c 69 6e |. Error| Handlin|
|000053f0| 67 0d 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |g.~~~~~~|~~~~~~~~|
|00005400| 7e 7e 7e 7e 0d 0d 55 4e | 49 58 20 70 72 6f 67 72 |~~~~..UN|IX progr|
|00005410| 61 6d 73 20 72 65 6c 79 | 20 6f 6e 20 74 68 65 20 |ams rely| on the |
|00005420| 73 74 61 6e 64 61 72 64 | 20 65 72 72 6e 6f 20 76 |standard| errno v|
|00005430| 61 72 69 61 62 6c 65 20 | 61 6e 64 20 6f 74 68 65 |ariable |and othe|
|00005440| 72 20 73 74 61 6e 64 61 | 72 64 20 66 75 6e 63 74 |r standa|rd funct|
|00005450| 69 6f 6e 73 20 74 6f 0d | 70 72 6f 76 69 64 65 20 |ions to.|provide |
|00005460| 65 72 72 6f 72 20 72 65 | 70 6f 72 74 69 6e 67 2e |error re|porting.|
|00005470| 20 20 55 6e 66 6f 72 74 | 75 6e 61 74 65 6c 79 2c | Unfort|unately,|
|00005480| 20 74 68 65 20 4d 61 63 | 69 6e 74 6f 73 68 20 64 | the Mac|intosh d|
|00005490| 6f 65 73 6e 27 74 20 68 | 61 76 65 20 61 6e 79 74 |oesn't h|ave anyt|
|000054a0| 68 69 6e 67 0d 71 75 69 | 74 65 20 6c 69 6b 65 20 |hing.qui|te like |
|000054b0| 74 68 61 74 2e 20 20 43 | 75 72 72 65 6e 74 6c 79 |that. C|urrently|
|000054c0| 2c 20 53 69 6d 70 6c 65 | 20 53 6f 63 6b 65 74 73 |, Simple| Sockets|
|000054d0| 20 70 72 6f 76 69 64 65 | 73 20 73 69 6d 69 6c 61 | provide|s simila|
|000054e0| 72 20 65 72 72 6f 72 20 | 72 65 70 6f 72 74 69 6e |r error |reportin|
|000054f0| 67 20 77 69 74 68 0d 74 | 77 6f 20 67 6c 6f 62 61 |g with.t|wo globa|
|00005500| 6c 20 76 61 72 69 61 62 | 6c 65 73 3a 20 20 67 45 |l variab|les: gE|
|00005510| 72 72 6e 6f 20 61 6e 64 | 20 67 4d 61 63 45 72 72 |rrno and| gMacErr|
|00005520| 6e 6f 2e 20 20 67 45 72 | 72 6e 6f 20 69 73 20 65 |no. gEr|rno is e|
|00005530| 73 73 65 6e 74 69 61 6c | 6c 79 20 74 68 65 20 73 |ssential|ly the s|
|00005540| 61 6d 65 20 61 73 0d 74 | 68 65 20 55 4e 49 58 20 |ame as.t|he UNIX |
|00005550| 65 72 72 6e 6f 20 76 61 | 72 69 61 62 6c 65 3b 20 |errno va|riable; |
|00005560| 67 4d 61 63 45 72 72 6e | 6f 20 77 69 6c 6c 20 63 |gMacErrn|o will c|
|00005570| 6f 6e 74 61 69 6e 20 74 | 68 65 20 6e 6f 72 6d 61 |ontain t|he norma|
|00005580| 6c 20 4d 61 63 69 6e 74 | 6f 73 68 20 4f 53 45 72 |l Macint|osh OSEr|
|00005590| 72 20 65 72 72 6f 72 0d | 6e 75 6d 62 65 72 20 69 |r error.|number i|
|000055a0| 66 20 74 68 65 20 65 72 | 72 6f 72 20 77 61 73 20 |f the er|ror was |
|000055b0| 63 61 75 73 65 64 20 62 | 79 20 61 20 4d 61 63 69 |caused b|y a Maci|
|000055c0| 6e 74 6f 73 68 20 72 6f | 75 74 69 6e 65 2e 20 20 |ntosh ro|utine. |
|000055d0| 49 66 20 61 6e 20 65 72 | 72 6f 72 20 6f 63 63 75 |If an er|ror occu|
|000055e0| 72 73 2c 20 6d 61 6b 65 | 0d 73 75 72 65 20 79 6f |rs, make|.sure yo|
|000055f0| 75 20 63 68 65 63 6b 20 | 62 6f 74 68 20 76 61 72 |u check |both var|
|00005600| 69 61 62 6c 65 73 2e 0d | 0d 42 79 20 6d 79 20 6f |iables..|.By my o|
|00005610| 77 6e 20 61 64 6d 69 73 | 73 69 6f 6e 2c 20 65 72 |wn admis|sion, er|
|00005620| 72 6f 72 20 72 65 70 6f | 72 74 69 6e 67 20 69 6e |ror repo|rting in|
|00005630| 20 53 69 6d 70 6c 65 20 | 53 6f 63 6b 65 74 73 20 | Simple |Sockets |
|00005640| 69 73 20 70 72 65 74 74 | 79 20 77 65 61 6b 2e 20 |is prett|y weak. |
|00005650| 20 54 68 69 73 0d 73 68 | 6f 75 6c 64 20 69 6d 70 | This.sh|ould imp|
|00005660| 72 6f 76 65 20 69 6e 20 | 74 68 65 20 66 75 74 75 |rove in |the futu|
|00005670| 72 65 2e 0d 0d 0d 38 2e | 20 20 53 75 67 67 65 73 |re....8.| Sugges|
|00005680| 74 65 64 20 52 65 61 64 | 69 6e 67 20 4c 69 73 74 |ted Read|ing List|
|00005690| 0d 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |.~~~~~~~|~~~~~~~~|
|000056a0| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 0d 0d 54 68 65 |~~~~~~~~|~~~..The|
|000056b0| 20 66 6f 6c 6c 6f 77 69 | 6e 67 20 69 73 20 61 20 | followi|ng is a |
|000056c0| 6c 69 73 74 20 6f 66 20 | 77 6f 72 6b 73 20 49 20 |list of |works I |
|000056d0| 73 75 67 67 65 73 74 20 | 6c 6f 6f 6b 69 6e 67 20 |suggest |looking |
|000056e0| 69 6e 74 6f 20 69 66 20 | 79 6f 75 20 61 72 65 20 |into if |you are |
|000056f0| 69 6e 74 65 72 65 73 74 | 65 64 20 69 6e 0d 73 6f |interest|ed in.so|
|00005700| 63 6b 65 74 20 6f 72 20 | 4d 61 63 54 43 50 20 70 |cket or |MacTCP p|
|00005710| 72 6f 67 72 61 6d 6d 69 | 6e 67 2e 20 20 54 68 69 |rogrammi|ng. Thi|
|00005720| 73 20 6c 69 73 74 20 69 | 6e 63 6c 75 64 65 73 20 |s list i|ncludes |
|00005730| 62 6f 6f 6b 73 2c 20 65 | 6c 65 63 74 72 6f 6e 69 |books, e|lectroni|
|00005740| 63 20 64 6f 63 75 6d 65 | 6e 74 73 2c 0d 57 6f 72 |c docume|nts,.Wor|
|00005750| 6c 64 20 57 69 64 65 20 | 57 65 62 20 70 61 67 65 |ld Wide |Web page|
|00005760| 73 2c 20 61 6e 64 20 74 | 68 65 20 6c 69 6b 65 2e |s, and t|he like.|
|00005770| 0d 0d 0d 41 70 70 6c 65 | 20 43 6f 6d 70 75 74 65 |...Apple| Compute|
|00005780| 72 2c 20 49 6e 63 2e 2e | 20 4d 61 63 54 43 50 20 |r, Inc..| MacTCP |
|00005790| 50 72 6f 67 72 61 6d 6d | 65 72 27 73 20 47 75 69 |Programm|er's Gui|
|000057a0| 64 65 2c 20 41 70 70 6c | 65 20 43 6f 6d 70 75 74 |de, Appl|e Comput|
|000057b0| 65 72 2c 20 49 6e 63 2e | 2c 20 31 39 39 31 2e 0d |er, Inc.|, 1991..|
|000057c0| 28 61 76 61 69 6c 61 62 | 6c 65 20 76 69 61 20 57 |(availab|le via W|
|000057d0| 57 57 20 61 74 20 6f 6e | 65 20 6f 66 20 41 70 70 |WW at on|e of App|
|000057e0| 6c 65 27 73 20 6d 61 6e | 79 20 57 65 62 20 73 65 |le's man|y Web se|
|000057f0| 72 76 65 72 73 29 0d 0d | 43 6f 6d 65 72 2c 20 44 |rvers)..|Comer, D|
|00005800| 6f 75 67 6c 61 73 20 45 | 2e 2c 20 44 61 76 69 64 |ouglas E|., David|
|00005810| 20 4c 2e 20 53 74 65 76 | 65 6e 73 2e 20 20 49 6e | L. Stev|ens. In|
|00005820| 74 65 72 6e 65 74 77 6f | 72 6b 69 6e 67 20 77 69 |ternetwo|rking wi|
|00005830| 74 68 20 54 43 50 2f 49 | 50 2c 20 56 6f 6c 75 6d |th TCP/I|P, Volum|
|00005840| 65 20 49 49 49 2e 0d 09 | 50 72 65 6e 74 69 63 65 |e III...|Prentice|
|00005850| 20 48 61 6c 6c 3a 20 45 | 6e 67 6c 65 77 6f 6f 64 | Hall: E|nglewood|
|00005860| 20 43 6c 69 66 66 73 2c | 20 4e 65 77 20 4a 65 72 | Cliffs,| New Jer|
|00005870| 73 65 79 2e 0d 09 0d 4c | 65 6e 74 7a 2c 20 52 6f |sey....L|entz, Ro|
|00005880| 62 65 72 74 2e 20 20 52 | 6f 62 65 72 74 20 4c 65 |bert. R|obert Le|
|00005890| 6e 74 7a 27 73 20 4d 61 | 63 69 6e 74 6f 73 68 20 |ntz's Ma|cintosh |
|000058a0| 50 72 6f 67 72 61 6d 6d | 69 6e 67 20 52 65 73 6f |Programm|ing Reso|
|000058b0| 75 72 63 65 73 2e 20 57 | 57 57 20 50 61 67 65 73 |urces. W|WW Pages|
|000058c0| 2e 0d 28 55 52 4c 3a 20 | 68 74 74 70 3a 2f 2f 77 |..(URL: |http://w|
|000058d0| 77 77 2e 61 73 74 72 6f | 2e 6e 77 75 2e 65 64 75 |ww.astro|.nwu.edu|
|000058e0| 2f 6c 65 6e 74 7a 2f 6d | 61 63 2f 70 72 6f 67 72 |/lentz/m|ac/progr|
|000058f0| 61 6d 6d 69 6e 67 2f 68 | 6f 6d 65 2d 70 72 6f 67 |amming/h|ome-prog|
|00005900| 2e 68 74 6d 6c 29 0d 0d | 53 74 65 76 65 6e 73 2c |.html)..|Stevens,|
|00005910| 20 52 69 63 68 61 72 64 | 20 57 2e 2e 20 55 4e 49 | Richard| W.. UNI|
|00005920| 58 20 4e 65 74 77 6f 72 | 6b 20 50 72 6f 67 72 61 |X Networ|k Progra|
|00005930| 6d 6d 69 6e 67 2e 20 50 | 72 65 6e 74 69 63 65 20 |mming. P|rentice |
|00005940| 48 61 6c 6c 3a 20 45 6e | 67 6c 65 77 6f 6f 64 20 |Hall: En|glewood |
|00005950| 43 6c 69 66 66 73 2c 0d | 09 4e 65 77 20 4a 65 72 |Cliffs,.|.New Jer|
|00005960| 73 65 79 2e 0d 0d 0d 39 | 2e 20 20 53 69 6d 70 6c |sey....9|. Simpl|
|00005970| 65 20 53 6f 63 6b 65 74 | 73 20 4c 69 63 65 6e 73 |e Socket|s Licens|
|00005980| 65 20 41 67 72 65 65 6d | 65 6e 74 0d 7e 7e 7e 7e |e Agreem|ent.~~~~|
|00005990| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|000059a0| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|000059b0| 0d 0d 53 69 6d 70 6c 65 | 20 53 6f 63 6b 65 74 73 |..Simple| Sockets|
|000059c0| 20 6d 61 79 20 62 65 20 | 66 72 65 65 6c 79 20 64 | may be |freely d|
|000059d0| 69 73 74 72 69 62 75 74 | 65 64 20 62 79 20 65 6c |istribut|ed by el|
|000059e0| 65 63 74 72 6f 6e 69 63 | 20 6d 65 61 6e 73 2c 20 |ectronic| means, |
|000059f0| 70 72 6f 76 69 64 65 64 | 20 74 68 61 74 20 69 74 |provided| that it|
|00005a00| 20 69 73 0d 6e 6f 74 20 | 6d 6f 64 69 66 69 65 64 | is.not |modified|
|00005a10| 20 69 6e 20 61 6e 79 20 | 77 61 79 20 61 6e 64 20 | in any |way and |
|00005a20| 74 68 61 74 20 69 74 20 | 69 73 20 61 63 63 6f 6d |that it |is accom|
|00005a30| 70 61 6e 69 65 64 20 62 | 79 20 61 6c 6c 20 6f 66 |panied b|y all of|
|00005a40| 20 74 68 65 20 6f 72 69 | 67 69 6e 61 6c 0d 64 6f | the ori|ginal.do|
|00005a50| 63 75 6d 65 6e 74 61 74 | 69 6f 6e 20 75 6e 61 6c |cumentat|ion unal|
|00005a60| 74 65 72 65 64 2e 20 0d | 0d 44 69 73 63 6c 61 69 |tered. .|.Disclai|
|00005a70| 6d 65 72 20 6f 66 20 77 | 61 72 72 61 6e 74 79 3a |mer of w|arranty:|
|00005a80| 0d 49 6e 20 75 73 69 6e | 67 20 74 68 69 73 20 73 |.In usin|g this s|
|00005a90| 6f 66 74 77 61 72 65 2c | 20 79 6f 75 20 75 6e 64 |oftware,| you und|
|00005aa0| 65 72 73 74 61 6e 64 20 | 61 6e 64 20 61 67 72 65 |erstand |and agre|
|00005ab0| 65 20 74 68 61 74 20 74 | 68 69 73 20 73 6f 66 74 |e that t|his soft|
|00005ac0| 77 61 72 65 20 69 73 20 | 70 72 6f 76 69 64 65 64 |ware is |provided|
|00005ad0| 0d d2 61 73 20 69 73 d3 | 20 77 69 74 68 6f 75 74 |..as is.| without|
|00005ae0| 20 77 61 72 72 61 6e 74 | 79 20 6f 66 20 61 6e 79 | warrant|y of any|
|00005af0| 20 6b 69 6e 64 2e 20 20 | 54 68 65 20 65 6e 74 69 | kind. |The enti|
|00005b00| 72 65 20 72 69 73 6b 20 | 61 73 20 74 6f 20 74 68 |re risk |as to th|
|00005b10| 65 20 72 65 73 75 6c 74 | 73 20 61 6e 64 0d 70 65 |e result|s and.pe|
|00005b20| 72 66 6f 72 6d 61 6e 63 | 65 20 6f 66 20 75 73 69 |rformanc|e of usi|
|00005b30| 6e 67 20 74 68 69 73 20 | 73 6f 66 74 77 61 72 65 |ng this |software|
|00005b40| 20 6c 69 65 73 20 65 6e | 74 69 72 65 6c 79 20 77 | lies en|tirely w|
|00005b50| 69 74 68 20 79 6f 75 2c | 20 74 68 65 20 75 73 65 |ith you,| the use|
|00005b60| 72 2e 20 20 54 68 65 20 | 61 75 74 68 6f 72 0d 64 |r. The |author.d|
|00005b70| 6f 65 73 20 6e 6f 74 20 | 6d 61 6b 65 20 61 6e 79 |oes not |make any|
|00005b80| 20 77 61 72 72 61 6e 74 | 69 65 73 2c 20 65 69 74 | warrant|ies, eit|
|00005b90| 68 65 72 20 65 78 70 72 | 65 73 73 65 64 20 6f 72 |her expr|essed or|
|00005ba0| 20 69 6d 70 6c 69 65 64 | 2c 20 69 6e 63 6c 75 64 | implied|, includ|
|00005bb0| 69 6e 67 20 62 75 74 20 | 6e 6f 74 0d 6c 69 6d 69 |ing but |not.limi|
|00005bc0| 74 65 64 20 74 6f 20 69 | 6d 70 6c 69 65 64 20 77 |ted to i|mplied w|
|00005bd0| 61 72 72 61 6e 74 69 65 | 73 20 6f 66 20 6d 65 72 |arrantie|s of mer|
|00005be0| 63 68 61 6e 74 61 62 69 | 6c 69 74 79 20 61 6e 64 |chantabi|lity and|
|00005bf0| 20 66 69 74 6e 65 73 73 | 20 66 6f 72 20 61 20 70 | fitness| for a p|
|00005c00| 61 72 74 69 63 75 6c 61 | 72 0d 70 75 72 70 6f 73 |articula|r.purpos|
|00005c10| 65 2c 20 77 69 74 68 20 | 72 65 73 70 65 63 74 20 |e, with |respect |
|00005c20| 74 6f 20 74 68 69 73 20 | 73 6f 66 74 77 61 72 65 |to this |software|
|00005c30| 2e 0d 0d 49 6e 20 6e 6f | 20 65 76 65 6e 74 20 73 |...In no| event s|
|00005c40| 68 61 6c 6c 20 74 68 65 | 20 61 75 74 68 6f 72 20 |hall the| author |
|00005c50| 62 65 20 6c 69 61 62 6c | 65 20 66 6f 72 20 61 6e |be liabl|e for an|
|00005c60| 79 20 63 6f 6e 73 65 71 | 75 65 6e 74 69 61 6c 2c |y conseq|uential,|
|00005c70| 20 69 6e 63 69 64 65 6e | 74 61 6c 2c 20 6f 72 0d | inciden|tal, or.|
|00005c80| 73 70 65 63 69 61 6c 20 | 64 61 6d 61 67 65 73 20 |special |damages |
|00005c90| 77 68 61 74 73 6f 65 76 | 65 72 20 28 69 6e 63 6c |whatsoev|er (incl|
|00005ca0| 75 64 69 6e 67 20 77 69 | 74 68 6f 75 74 20 6c 69 |uding wi|thout li|
|00005cb0| 6d 69 74 61 74 69 6f 6e | 20 64 61 6d 61 67 65 73 |mitation| damages|
|00005cc0| 20 66 6f 72 20 6c 6f 73 | 73 20 6f 66 0d 63 72 69 | for los|s of.cri|
|00005cd0| 74 69 63 61 6c 20 64 61 | 74 61 2c 20 6c 6f 73 73 |tical da|ta, loss|
|00005ce0| 20 6f 66 20 70 72 6f 66 | 69 74 73 2c 20 69 6e 74 | of prof|its, int|
|00005cf0| 65 72 72 75 70 74 69 6f | 6e 20 6f 66 20 62 75 73 |erruptio|n of bus|
|00005d00| 69 6e 65 73 73 2c 20 61 | 6e 64 20 74 68 65 20 6c |iness, a|nd the l|
|00005d10| 69 6b 65 29 20 61 72 69 | 73 69 6e 67 0d 6f 75 74 |ike) ari|sing.out|
|00005d20| 20 6f 66 20 74 68 65 20 | 75 73 65 20 6f 72 20 69 | of the |use or i|
|00005d30| 6e 61 62 69 6c 69 74 79 | 20 74 6f 20 75 73 65 20 |nability| to use |
|00005d40| 74 68 69 73 20 73 6f 66 | 74 77 61 72 65 2e 20 20 |this sof|tware. |
|00005d50| 42 65 63 61 75 73 65 20 | 73 6f 6d 65 20 73 74 61 |Because |some sta|
|00005d60| 74 65 73 20 64 6f 20 6e | 6f 74 0d 61 6c 6c 6f 77 |tes do n|ot.allow|
|00005d70| 20 74 68 65 20 65 78 63 | 6c 75 73 69 6f 6e 20 6f | the exc|lusion o|
|00005d80| 72 20 6c 69 6d 69 74 61 | 74 69 6f 6e 20 6f 66 20 |r limita|tion of |
|00005d90| 6c 69 61 62 69 6c 69 74 | 79 20 66 6f 72 20 63 6f |liabilit|y for co|
|00005da0| 6e 73 65 71 75 65 6e 74 | 69 61 6c 20 6f 72 20 69 |nsequent|ial or i|
|00005db0| 6e 63 69 64 65 6e 74 61 | 6c 0d 64 61 6d 61 67 65 |ncidenta|l.damage|
|00005dc0| 73 2c 20 74 68 65 20 61 | 62 6f 76 65 20 6c 69 6d |s, the a|bove lim|
|00005dd0| 69 74 61 74 69 6f 6e 73 | 20 6d 61 79 20 6e 6f 74 |itations| may not|
|00005de0| 20 61 70 70 6c 79 20 74 | 6f 20 79 6f 75 2e 0d 0d | apply t|o you...|
|00005df0| 41 6c 74 68 6f 75 67 68 | 20 74 68 65 20 61 75 74 |Although| the aut|
|00005e00| 68 6f 72 20 77 6f 75 6c | 64 20 61 70 70 72 65 63 |hor woul|d apprec|
|00005e10| 69 61 74 65 20 61 6e 79 | 20 66 65 65 64 62 61 63 |iate any| feedbac|
|00005e20| 6b 20 61 6e 64 20 62 75 | 67 20 72 65 70 6f 72 74 |k and bu|g report|
|00005e30| 73 2c 20 74 68 65 20 61 | 75 74 68 6f 72 0d 73 68 |s, the a|uthor.sh|
|00005e40| 61 6c 6c 20 6e 6f 74 20 | 62 65 20 72 65 73 70 6f |all not |be respo|
|00005e50| 6e 73 69 62 6c 65 20 66 | 6f 72 20 63 6f 72 72 65 |nsible f|or corre|
|00005e60| 63 74 69 6e 67 20 61 6e | 79 20 70 72 6f 62 6c 65 |cting an|y proble|
|00005e70| 6d 73 20 77 68 69 63 68 | 20 79 6f 75 20 64 69 73 |ms which| you dis|
|00005e80| 63 6f 76 65 72 20 6f 72 | 0d 6f 74 68 65 72 77 69 |cover or|.otherwi|
|00005e90| 73 65 20 68 65 6c 70 20 | 79 6f 75 20 6d 61 69 6e |se help |you main|
|00005ea0| 74 61 69 6e 20 61 6e 64 | 20 75 73 65 20 74 68 69 |tain and| use thi|
|00005eb0| 73 20 73 6f 66 74 77 61 | 72 65 2e 20 20 46 75 72 |s softwa|re. Fur|
|00005ec0| 74 68 65 72 6d 6f 72 65 | 2c 20 74 68 65 20 61 75 |thermore|, the au|
|00005ed0| 74 68 6f 72 20 6d 61 79 | 0d 61 74 20 61 6e 79 20 |thor may|.at any |
|00005ee0| 74 69 6d 65 20 72 65 70 | 6c 61 63 65 2c 20 6d 6f |time rep|lace, mo|
|00005ef0| 64 69 66 79 2c 20 61 6c | 74 65 72 2c 20 69 6d 70 |dify, al|ter, imp|
|00005f00| 72 6f 76 65 2c 20 65 6e | 68 61 6e 63 65 20 6f 72 |rove, en|hance or|
|00005f10| 20 63 68 61 6e 67 65 20 | 74 68 69 73 20 73 6f 66 | change |this sof|
|00005f20| 74 77 61 72 65 2e 0d 0d | 43 6f 6d 70 6c 65 74 65 |tware...|Complete|
|00005f30| 20 61 67 72 65 65 6d 65 | 6e 74 3a 0d 54 68 69 73 | agreeme|nt:.This|
|00005f40| 20 61 67 72 65 65 6d 65 | 6e 74 20 63 6f 6e 73 74 | agreeme|nt const|
|00005f50| 69 74 75 74 65 73 20 74 | 68 65 20 65 6e 74 69 72 |itutes t|he entir|
|00005f60| 65 20 61 67 72 65 65 6d | 65 6e 74 20 61 6e 64 20 |e agreem|ent and |
|00005f70| 73 75 70 65 72 73 65 64 | 65 73 20 61 6e 79 20 70 |supersed|es any p|
|00005f80| 72 69 6f 72 0d 61 67 72 | 65 65 6d 65 6e 74 73 20 |rior.agr|eements |
|00005f90| 62 65 74 77 65 65 6e 20 | 79 6f 75 20 61 6e 64 20 |between |you and |
|00005fa0| 74 68 65 20 61 75 74 68 | 6f 72 20 63 6f 6e 63 65 |the auth|or conce|
|00005fb0| 72 6e 69 6e 67 20 74 68 | 69 73 20 73 6f 66 74 77 |rning th|is softw|
|00005fc0| 61 72 65 2e 20 20 54 68 | 69 73 20 61 67 72 65 65 |are. Th|is agree|
|00005fd0| 6d 65 6e 74 0d 63 61 6e | 6e 6f 74 20 62 65 20 61 |ment.can|not be a|
|00005fe0| 6d 65 6e 64 65 64 2c 20 | 6d 6f 64 69 66 69 65 64 |mended, |modified|
|00005ff0| 2c 20 6f 72 20 77 61 69 | 76 65 64 20 65 78 63 65 |, or wai|ved exce|
|00006000| 70 74 20 69 6e 20 77 72 | 69 74 69 6e 67 2e 0d 0d |pt in wr|iting...|
|00006010| 47 65 6e 65 72 61 6c 3a | 0d 49 66 20 61 6e 79 20 |General:|.If any |
|00006020| 70 72 6f 76 69 73 69 6f | 6e 20 6f 66 20 74 68 69 |provisio|n of thi|
|00006030| 73 20 61 67 72 65 65 6d | 65 6e 74 20 73 68 61 6c |s agreem|ent shal|
|00006040| 6c 20 62 65 20 66 6f 75 | 6e 64 20 74 6f 20 62 65 |l be fou|nd to be|
|00006050| 20 75 6e 65 6e 66 6f 72 | 63 65 61 62 6c 65 2c 20 | unenfor|ceable, |
|00006060| 69 74 20 73 68 61 6c 6c | 0d 62 65 20 64 65 65 6d |it shall|.be deem|
|00006070| 65 64 20 73 65 76 65 72 | 65 64 20 66 72 6f 6d 20 |ed sever|ed from |
|00006080| 74 68 65 20 72 65 6d 61 | 69 6e 64 65 72 20 6f 66 |the rema|inder of|
|00006090| 20 74 68 69 73 20 61 67 | 72 65 65 6d 65 6e 74 2e | this ag|reement.|
|000060a0| 0d 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000060b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000060c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000060d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000060e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000060f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00006100| 00 00 01 00 00 00 02 6c | 00 00 01 6c 00 00 00 32 |.......l|...l...2|
|00006110| 6f 6e 20 4f 6e 6c 79 00 | 00 00 00 00 08 00 08 00 |on Only.|........|
|00006120| 18 00 4b 06 06 49 6e 73 | 65 72 74 00 00 00 00 00 |..K..Ins|ert.....|
|00006130| 15 53 69 6d 70 6c 65 20 | 53 6f 63 6b 65 74 73 20 |.Simple |Sockets |
|00006140| 4d 61 6e 75 61 6c 02 00 | 00 00 50 61 72 74 53 49 |Manual..|..PartSI|
|00006150| 00 00 50 61 72 74 53 49 | 54 21 00 00 00 00 00 00 |..PartSI|T!......|
|00006160| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00006170| 00 00 ab f8 9c 9a 00 00 | 00 00 00 00 02 9e a0 00 |........|........|
|00006180| 50 00 f3 88 0c 6f 66 20 | 65 61 63 68 20 6c 69 6e |P....of |each lin|
|00006190| 65 00 00 00 00 00 40 00 | 04 00 50 00 30 88 06 61 |e.....@.|..P.0..a|
|000061a0| 74 20 74 68 65 00 00 00 | 15 00 3f 00 46 00 c0 01 |t the...|..?.F...|
|000061b0| ae 00 01 01 00 00 00 00 | 00 00 00 00 80 00 00 00 |........|........|
|000061c0| 01 00 00 00 0a be 00 00 | 09 be 00 00 00 a3 00 b2 |........|........|
|000061d0| 71 98 25 18 00 00 00 1c | 00 8e 00 04 42 42 58 54 |q.%.....|....BBXT|
|000061e0| 00 00 00 2a 76 65 72 73 | 00 01 00 36 42 42 58 46 |...*vers|...6BBXF|
|000061f0| 00 00 00 4e 44 49 54 4c | 00 00 00 5a 44 4c 4f 47 |...NDITL|...ZDLOG|
|00006200| 00 00 01 68 52 2a 63 68 | 02 50 00 28 00 1e 02 1e |...hR*ch|.P.(....|
|00006210| 01 78 00 18 00 00 00 00 | 00 00 00 00 00 00 00 00 |.x......|........|
|00006220| 00 04 00 09 00 00 06 4d | 6f 6e 61 63 6f 00 00 00 |.......M|onaco...|
|00006230| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00006240| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00006250| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00006260| 00 00 00 00 00 00 03 00 | 00 0c 00 00 00 48 00 48 |........|.....H.H|
|00006270| 00 00 00 00 02 f0 02 40 | ff ec ff ee 03 04 02 52 |.......@|.......R|
|00006280| 64 02 05 28 03 fc 01 00 | 00 00 01 68 01 68 00 00 |d..(....|...h.h..|
|00006290| 00 00 0e b0 0b 40 00 01 | 00 00 00 64 00 01 00 00 |.....@..|...d....|
|000062a0| 00 01 00 00 00 00 00 01 | 27 0f 00 01 00 00 00 00 |........|'.......|
|000062b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000062c0| 00 00 00 00 00 00 ff 9c | ff a6 0f 14 0b 9a 00 08 |........|........|
|000062d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000062e0| 00 04 00 09 00 00 06 4d | 6f 6e 61 63 6f 08 00 00 |.......M|onaco...|
|000062f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00006300| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00006310| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00006320| 00 00 00 00 00 00 00 04 | 01 00 00 01 00 00 00 00 |........|........|
|00006330| 00 01 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00006340| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00006350| 00 00 00 00 00 00 00 00 | 00 00 00 00 01 01 00 01 |........|........|
|00006360| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 01 00 |........|........|
|00006370| 00 00 02 6c 00 00 01 6c | 00 00 00 32 00 a0 71 50 |...l...l|...2..qP|
|00006380| 15 ac 00 00 00 1c 00 32 | 00 00 42 42 53 52 00 00 |.......2|..BBSR..|
|00006390| 00 0a 02 50 ff ff 00 00 | 00 00 00 a0 6e 54 00 00 |...P....|....nT..|
|000063a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000063b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000063c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000063d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000063e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000063f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+