home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / kcg.zip / KCG.TXT < prev   
Text File  |  1999-06-20  |  12KB  |  221 lines

  1. KCG.CMD for OS/2:  "Keep-Connected" to Internet
  2. Freeware  R.J.Holmgren  will13@interport.net  6/20/99
  3.  
  4. The Keep-Connected Gimmick (KCG) is a flexible, diagnostic tool to
  5. determine the maximum amount of inactive time that an ISP will allow, and
  6. then to keep connected to the ISP with minimal load on both your CPU and
  7. your Internet bandwidth.  KCG prevents dial-up ISPs from disconnecting
  8. users peremptorily for "idleness".
  9.  
  10. DISCLAIMER!  Attempts to bypass idle time-outs MAY BE PROHIBITED BY YOUR
  11. ISP, and may even cause the ISP to terminate your dial-up account.  You
  12. are hereby warned.  THERE ARE NO WARRANTIES WHATSOEVER; YOU ASSUME ALL
  13. RISKS.  Delete this program NOW if you are unwilling to bear, solely, ALL
  14. consequences of its use, misuse, or abuse, whether witting or unwitting.
  15.  
  16.   Requirements:
  17.   ------------
  18. OS/2 Rexx must be installed.
  19.  
  20. For the FTP method:
  21.   RXFTP.DLL v2.0 (103701 bytes, dated 9-23-97) or higher must be located
  22.   in the LIBPATH (usually \TCPIP\DLL).  RXFTP.DLL is a standard component
  23.   of OS/2; obtain version 2.0(+) from IBM at:
  24.     ftp://ftp.software.ibm.com/ps/products/os2/rsu/rsuinstn.exe
  25.  
  26. For the PING method:
  27.   PING.EXE and RXQUEUE.EXE (standard OS/2 components) must be in the PATH.
  28.  
  29.   Command [nine optional arguments]:
  30.   -------
  31. kcg hostname|IPaddress
  32.       user_ID
  33.         password
  34.           minimum_interval_between_hits (in seconds)
  35.             maximum_interval_between_hits (in seconds)
  36.               increment_amount (increase laziness, in seconds)
  37.                 L|m (progressive "L"aziness, or "M"aximum interval only)
  38.                   F|p (use "F"TP or "P"ING method)
  39.                     A|d (run as "A"ttached, or "D"etached, process)
  40. kcg ?|/?|-?|help  command summary
  41.  
  42.   e.g.
  43. kcg 152.163.212.93 anonymous mikhail@bakunin.org.ru 120 660 60 L F A  [defaults]
  44. kcg ftp.aol.com anonymous mikhail@bakunin.org.ru  [as above but slower]
  45. kcg ftp.microsoft.com
  46. kcg 207.46.133.140  [same as "ftp.microsoft.com" above but faster]
  47. detach kcg.cmd idt.net . . . 510 . . . D [override defaults 1,5,&9; Detach KCG]
  48. kcg 192.20.225.4 . me@myisp.com  [override 1 ("ftp.research.att.com") & 3]
  49.  
  50. Use periods as placeholders (i.e. to default to hard-coded values,
  51.   which are stored in USER SETTINGS).
  52.  
  53.   Description:
  54.   -----------
  55. Two basic "methods" of operation are offered.  If your ISP recognizes PING
  56. as "user activity", then KCG can use PING to "Keep-Connected".  But some
  57. cheapskate toughminded ISPs no longer honor PING.  To manage them, KCG
  58. connects to any FTP and asks a stupid question (what operating system the
  59. FTP uses).  KCG remains logged on to FTP until you kill (or lose) the
  60. connection (or until you abort KCG.CMD [Ctrl-C]).  Upon detecting
  61. DISconnection, KCG reports enough debugging information to fine-tune
  62. future operation to a shorter or (probably) longer maximum interval, for
  63. greater effectiveness with the least load.  KCG displays its final
  64. diagnostic messages to the screen, writes these diagnostic messages to
  65. file KCG.LOG (located in the same directory as KCG.CMD, unless you run KCG
  66. from a different "Working directory"), then exits.  Turn logging off by
  67. setting variable "logfile='N'" in USER SETTINGS.
  68.  
  69. Interestingly, the FTP method tends to permit a longer maximum interval
  70. of inactivity than the PING method.  Typically, Hosts that recognize PING
  71. allow about 20 minutes of idleness before disconnecting, whereas FTP
  72. connections established with the *same* Host often time-out after 30-45
  73. minutes.
  74.  
  75. Launch KCG before connecting, or during a connection.  If you launch KCG
  76. before connecting, every 2 minutes it will check whether a connection has
  77. been established.  Two high beeps indicate Connect, two low beeps signal
  78. Disconnect (after having been Connected); if using the PING method, a high
  79. beep followed by a low beep indicates that you are connected but the Host
  80. is not replying to Ping, or that the specified Host is "unknown", i.e.
  81. you're providing a bad IP address or Hostname.  If high+low beeps persist,
  82. you probably need to alter your settings:  correct a bad IP address, or
  83. switch to the FTP method, or set user variable "retries" to a higher value
  84. than [default=] 20.
  85.  
  86. If a disconnect occurs while KCG is running, but KCG has not yet detected
  87. it and you wish to immediately reconnect, terminate KCG manually and
  88. restart KCG from scratch before redialing (see "Note", below).
  89.  
  90. There are many ways to optimize the interval between hits.  Simplest is to
  91. reset the connection timer in DOIP (Dial Other Internet Providers, a.k.a.
  92. "IBM Dial-Up for TCP/IP") before dialing (click "Configure==>Reset Total
  93. Connect Time"), then remain completely inactive, to get a rough idea of
  94. how soon you time-out.  Note however that this will indicate a time-out
  95. period applicable only to the PING method (FTP connections often have a
  96. much longer time-out).  A different, trial-and-error approach might raise
  97. the maximum period of inactivity permitted by your ISP [5th argument] to a
  98. moderate level, e.g. 1800 (30 minutes), and set KCG's 7th argument to
  99. "M"aximum so that only this (e.g. 30 minute) interval is used (no
  100. "L"aziness).  If that works, then you might just leave well enough alone;
  101. if it doesn't work, you could reduce the inactivity period in 1 or 2
  102. minute stages until your ISP no longer disconnects you.
  103.  
  104. However, the RECOMMENDED, meticulous technique is to hit the ISP (with
  105. either the FTP or PING method) at gradually increasing intervals, until
  106. you are disconnected because of "idleness".  Between hits, KCG
  107. "SysSleeps".  For example, set KCG's 4th argument at a low value such as
  108. 600 (10 minutes), raise the 5th argument to a high value such as 7200 (2
  109. hours), and increment in large steps, e.g. 300 (5 minutes) [6th argument],
  110. using 'L'azy mode [7th argument].  If your ISP never disconnects you, then
  111. you don't need KCG (you've got a good ISP!).  Otherwise, start fine-tuning
  112. by narrowing the minimum and maximum intervals of KCG operation to the
  113. range during which you were disconnected (bounded by the reported "last
  114. successful interval between hits" prior to disconnection and the "final
  115. [failed] interval between hits" -- the first worked, while the second
  116. failed to prevent disconnection).  Also reduce the increment to 30 or 60
  117. seconds.
  118.  
  119. If you are disconnected while operating at the constant, maximum interval,
  120. then either it is set too high, or else extrinsic factors caused
  121. disconnection (possibly a long delay in Host response [the reported
  122. "duration of last contact"] which affected the Host's timing).  Try
  123. reducing the maximum interval by 30 seconds or so.  Remember that the
  124. ISP's timing is usually hair-trigger and invariable; if the timeout is 40
  125. minutes, you'll be offline by 40:01, every time.
  126.  
  127. Once you determine the optimum interval [5th argument], you can set KCG's
  128. 7th argument to "M", to hit your ISP only at that Maximum interval of time
  129. (instead of gradually increasing the interval until you reach your
  130. Maximum).  Note that for any change of settings to take effect, you must
  131. terminate KCG.CMD and re-launch it.
  132.  
  133. For small load and fast response using the FTP method, you may want to
  134. poll the Host to which you are currently connected, *if* it offers FTP.
  135. Otherwise, communication with ANY Host in your neighborhood will persuade
  136. your own ISP that you're "active".  (It's possible that your ISP monitors
  137. users of its own FTP facilities, and might find "peculiar" your pattern of
  138. constant connection with near-zero activity; whereas it would be unlikely
  139. to monitor your usage of a remote FTP, or to try to discipline a user who
  140. logs in _from_ another ISP.  Also, a few FTPs will only talk with users
  141. who log in from a Host|IP with a valid DNS.)
  142.  
  143. Load also decreases if the server doesn't need to resolve the Hostname
  144. that you provide (e.g. "idt.net") into an IP address (169.132.8.10).
  145. So use the IP address directly; get it with DIG:
  146.   http://kryten.eng.monash.edu.au/gspamt.html
  147. Execute "Do DIG hostname->ipaddress".  Supply an alphanumeric Hostname,
  148. and then use a numeric IP address listed in DIG's ";; ANSWERS:" stanza.
  149. If you're using an *invalid* Hostname or IP address, or the FTP declines
  150. to talk to you (bad userID|password?), then KCG will abort.  Find a Host
  151. with rapid response, just one or two seconds.
  152.  
  153. Finally, you can run KCG as a Detached process, by using OS/2's DETACH
  154. command and setting KCG's 9th argument to "D" (see command example,
  155. above).  There will be no output apart from Connection|Disconnection
  156. Beeps, the maximum interval ONLY will be used, no KCG.LOG is written to
  157. disk, and you'll need a process killer to abort operation (such as
  158. Ctrl+LMB in WarpCenter's "Switch to another application", with
  159. SET KILLFEATUREENABLED=ON in CONFIG.SYS; KCG will be listed as "CMD.EXE" --
  160. be careful, other processes may also be listed as "CMD.EXE").  But the
  161. load on your machine will be reduced to the bare minimum.
  162.  
  163. General Procedure for Determining Maximum Wait Interval:
  164. ------- --------- --- ----------- ------- ---- --------
  165. Do this one-time operation in two phases, with NO other Internet
  166. communication.  Typically it takes 2-4 hours.
  167.  
  168. Suppose you know that the ISP won't disconnect you for at least 10
  169. minutes.  Initially, command:
  170.   kcg ftp.myisp.com anonymous me@myisp.com 600 7200 300 L<cr>
  171. Thus:
  172.     minimum wait interval [arg 4]=10 minutes
  173.     maximum wait interval [arg 5]=120 minutes (arbitrary; set it high!)
  174.     "L"azy incremental step [arg 6]=5 minutes
  175. On the first round, KCG hits the ISP in 10 minutes, on the second round
  176. after 15 minutes elapse, third round after 20 minutes, etc.  Suppose you
  177. are disconnected between intervals of 30 and 35 minute (1800-2100 second)
  178. duration:  now command:
  179.   kcg ftp.myisp.com anonymous me@myisp.com 1800 2100 60 L<cr>
  180. In other words, narrow the spread between minimum and maximum wait
  181. intervals to 30 and 35 minutes, respectively, and reduce the incremental
  182. step to 1 minute.  Suppose that in this second phase you are disconnected
  183. when the current interval is 33 minutes:  you learn thereby that the ISP
  184. times out and disconnects between 32 and 33 minutes of inactivity.  So now
  185. you can formulate your final command:
  186.   kcg ftp.myisp.com anonymous me@myisp.com . 1920 . M [F|P] [D]<cr>
  187. I.e. hit the ISP at constant 32 minute intervals.
  188.  
  189. Perform this procedure with both PING and FTP, to determine which method
  190. tolerates the longest period of idleness.
  191.  
  192. Tip:  Instead of issuing runtime arguments, adjust the USER SETTINGS
  193. (defaults), and then run KCG.CMD hands-off (without args).
  194. Alternatively (easiest), establish a Program object on the Desktop, enter
  195. "[d:\path\]KCG.CMD" in "Required path and file name", and enter the
  196. arguments in "Optional Parameters".  To launch KCG as a Detached
  197. process from a Program object, enter "DTACHKCG.CMD" (part of KCG.ZIP) as
  198. the "file name" (instead of "KCG.CMD"); be sure to set "D" as the 9th
  199. argument.  All *.CMD files should be situated in the OS/2 PATH!
  200.  
  201. Note:  RXFTP.DLL has some quirks.  When a connection is broken, RXFTP.DLL
  202. freezes on all commands issued to the remote Host EXCEPT FtpPing.  This
  203. has two implications for the FTP method (only):
  204.  
  205. 1) To prevent freezing, KCG sends a one-byte FtpPing to verify that
  206. there is a phone link to an ISP before commencing an "active" FTP
  207. communication with the ISP.  Note carefully:  if you're using the FTP
  208. method to keep-connected, then a successful send is what counts; it
  209. doesn't matter whether the ISP replies to FtpPing or not, because there
  210. will be a followup query concerning the ISP's OpSys to which KCG expects a
  211. valid response.  BUT if you are using the PING method, then KCG requires a
  212. reply to Ping.  The reason is that ISP's deem "activity" to be on *their*
  213. part, not the client's part.  If they don't respond, then there's no
  214. activity (or so I deduce, from observation of ISP behavior).
  215.  
  216. 2) If a disconnect occurs, KCG needs to be terminated and restarted before
  217. you can use KCG again (after reconnecting), because RXFTP.DLL needs to
  218. completely reinitialize its relationship with the remote server (it
  219. doesn't seem to be enough to simply LogOff; you have to quit the CMD.EXE
  220. session that launched RXFTP.DLL and start again).
  221.