Ref: 03050019
Title: How to Conditionally Load and Unload TSRs in 3+Open TCP/IP 1.0 and 1.1
Date:  5/10/91

Copyright 3Com Corporation, 1991.  All rights reserved.

Following is a method to expedite switching between VT, FTP, and other
programs, to make the use of these programs faster and more convenient
in a DOS environment.  All of the required batch files are contained in
the Ask3Com forum, Unsupported Utilities library, in the file IPLOAD.ZIP.

Here is a description of each file in IPLOAD.ZIP:

   LOADTCP:  Loads all of the TCP/IP TSRs that VT and FTP require.  You
can type VT or FTP and quickly switch between these utilities.

   UNLOAD:  Frees up memory consumed by TCP/IP TSRs to be used by large
applications such as 3+Open Mail.  (Note:  This program is in 3+Open TCP.)

   BAPICHK:  Tests for the presence of the Bridge Application Program
Interface (BAPI), which is among the TSR programs loaded by LOADTCP.

With BAPICHK, additional batch files such as AVT, AFTP, and AMAIL (also
included in IPLOAD.ZIP) allow you to switch quickly between various
programmatic environments, loading and unloading the 3+Open TCP/IP TSRs
only as required to switch between application programs.

BAPICHK tests the BAPI interface by running the BAPI "Interface
version" function call (hex AF), using the BAPI interrupt (hex) 14
interface.  If the BAPI TSR is not loaded, then BAPICHK returns an
errorlevel of 255 (hex FF).  If BAPI is present, BAPICHK returns
errorlevel 0 (providing that the BAPI interface is version 1 -- as
it is and is likely to remain), or errorlevel 1 for version 2, etc.  The
AMAIL.BAT file provides an example of how BAPICHK can be used:

   @echo off
   rem check if bapi interface is loaded
   BAPICHK
   if errorlevel 1 goto endcheck
   rem unload all tcp/ip tsr programs
   echo Unloading TCP/IP Protocols...
   UNLOAD
   :endcheck
   rem run the mail program
   NMAIL %1 %2 %3 %4 %5 %6 %7 %8 %9

In this example, the line following "BAPICHK" jumps to the "endcheck"
label if BAPI is not currently loaded (that is, if errorlevel 1 is
returned).  If the jump is not taken (meaning, BAPI is loaded), then UNLOAD
is called to unload it.

The AMAIL batch file is an example of how large application programs,
which need the memory that TCP/IP TSRs consume, can be accommodated.

The use of the "CALL LOADTCP" batch file command in the AVT and AFTP
batch files uses a DOS 3.30 innovation.  For those running DOS versions
3.20 or before, replace the "CALL LOADTCP" line in AVT and AFTP with:

TCPTSR
        DNRTSR
        SOCKTSR
        TN
        BAPI

Note:  The @ at the beginning of "echo off" is also DOS 3.30; remove it.

