Copyright: Copyright Tod Liverseed of TGL_Micro
Citation: Copyright Tod Liverseed of TGL_Micro


Communications

Basic Communications

Window’s serial communication is a complex system. In the DOS world communications were relatively simple. This is not so in a Cooperative multitasking operation system. I will not attempt to explain every aspect of Windows communications but I will give you a little introduction.

All ‘low level’ communications in windows are handled by the communications driver, usually ‘COMM.DRV.' The communications driver monitors the physical comports of the computer and sends windows ‘messages’ when certain events occur. There are a few of third party communications drivers that you can obtain that handle high speed communications better than the stock driver installed with windows.

A few of the terms you need to become familiar with are:

Baud Rate:

Data bits, Stop bits and Parity:

File transfer protocols

Flow Control


Baud Rate

The term baud rate is a measurement of the number of events per second in a communications line. This usually means the higher the speed the better the performance. Generally a 80386 machine should be able to handle 9600 without much problem. Most 486 and Pentium systems can handle baud rates as high as 115.2K. Because of  the way Windows handles communications even fast computers may have problems with baud rates that high.

Another limitation on your baud rate is the UART chip. This chip is the heart of all serial communications. There are basically 3 types of UARTS:

8250

16450

16550

As a general guideline you can use these settings depending upon the speed of your modem.

Your Modem:     Desired Baud Rate:

     2400:     	2400 - 9600

     9600:     	19200

     14400:   	38400 - 57600

     28800+:   	38400 - 115200

Performance Note:


Data Bits

Data bits are usually set at 7 or 8 bits. These data bits are the actually information carrying bits. Most BBS systems use 8 data bits, while some ‘on-line’ services, such as CompuServe, use 7 data bits.

Com supports both with ease.

Stop Bits

Stop bits follow the data bits in the serial communications stream. This can be either  1 or 2 bits. Most of the time you should set this to 1 stop bit.

Parity

Parity is a kind of error checking scheme. In a typical communications session, the transmitter adds all the data bits together. It then adds a Parity bit so that the sum of all the bits is either Even, Odd or whatever you want. The receiver also calculates these bits. If they match then it is assumed that the data was received without any errors.

Most BBS systems do not use parity. Most on-line services do use parity.


Registering Com

Registering Com will get rid of the nag screen and enable the scripting ability. The price I am asking is a darn good price compared to other communications packages. So I ask that you register Com and support the shareware concept.

The only way I accept registrations is either by check or money order. When you do register all you need to do is send me your First and Last name and a check for $20.00. I will then send you your registration code to unlock the program. I will either send it through E-Mail or Postal Mail. You can also contact the Magic BBS at 1-507-334-1648. I will leave your registration code in a message there also.

Now for the real boring stuff!

I have tried to put together a good communication program for all Windows users. I cannot guarantee that it is bug free. I will try to fix bugs in a timely manor. I am also open to any gripes or suggestions. I made this for YOU the user.

One more thing.... I am NOT liable for ANYTHING! If you install Com and your hard dive is thrashed.... Oh, well. I will lend tech advice but that’s were it ends.

Tod Liverseed

PO BOX 422

Morristown MN

55052-0422


 8250 Uart

Slow. Baud rates above 14400 are NOT recommended.


16450 UART

This is a little better chip than the 8250 but not much.


16550 UART

Much better. Can handle extremely high baud rates.


You can experience performance losses if you set your baud rate too high also. For instance, a computer with a 486 processor, 8250 UART chip and an external modem can not handle baud rates above 14400 reliably. To see what UART you have try running Microsoft’s MSD program.


File Transfer Protocols

In most communications sessions you will either be sending or receiving binary files.Of course you can send files both directions. When you send a file to a remote system its called ‘Uploading’. When you are receiving a file from a remote system it is them called ‘Downloading’. A file protocol must also be used. Both sides MUST use the same protocol or nothing will happen. The most commonly used protocol is ZMODEM. It has a lot of features, is very fast and corrects errors on the fly.

Example:  Lets say you found a file on a remote BBS that you wanted. You simply tell the remote system which file you want to send and how to send it(which protocol). If you choose Zmodem then your work is complete because Zmodem has an auto start feature. If you choose another protocol then you must select ‘Download’ at this time. Then choose the same protocol you chose on the remote system.

Supported protocols:

XMODEM

XMODEMCRC

XMODEM1K

YMODEM

YMODEMG

ZMODEM

KERMIT

CompuServe B+

There are also special options that COM allows you to tailor to your needs.


Protocol Options

There are many options that change the way files are transferred between computers. In most cases you can leave these at their default values. Power users like to tweak these settings.

Honor Incoming Directory

Include Outgoing Directory

RTS low for Writes

Abort if DCD lost

Name Collision

File options override

Skip no files

Crash Recovery

8K Zmodem

File management

Kermit Blocks

Kermit Windows

Kermit Timeout

Inter char delay

Inter line delay

EOF timeout

CR Translation

LF Translation


Line feed Translation

Determines how COM handles an incoming Line Feed character during an ASCII file transfer.

none	Default. Do not change.

Strip	Strip the character.

Add CR before	Adds a Carriage return before the LF.

Add LF After	Does nothing.


CR Translation

Determines how COM handles a Carriage Return

none	Default. Do not change.

Strip	Strip the character

Add CR before	Does nothing

Add LF After	Adds a Line feed after the CR.


EOF Timeout

This is the number of tick before an ASCII file transfer is automatically stopped.


Inter line delay

Determines how many milliseconds to delay between transferring lines in an ASCII file transfer. The default is 0


Inter character delay
Inter Char delay

Determines the number of milliseconds to wait before transfering another character in an ASCII file transfer. The default is 0.


Kermit Timeout

Determines how long Kermit will wait for the next expected byte. The default is 5.


Kermit Windows

This determines if Kermit sliding windows is enabled. This should have a value of 1 to 27.


Kermit Blocks

Determines the block length of the Kermit blocks


File management options
File management options(Zmodem only)

These options determine how Zmodem handles a file transfer and solves naming conflicts.

None:	do nothing

Newer or longer	Transfer only if newer or longer

CRC Different	Transfer only if CRC diff.

Append	Append incoming to existing

Overwrite	Overwrite existing

Newer	Accept only if newer

Different	Accept if different

Reject	Reject incoming

This is only effective if you also Override the senders options


Zmodem 8K
Zmodem 8K(Zmodem only)

If you select this first be sure the remote supports this option. This is a high performance version of Zmodem. It sends 8K blocks instead of 1K blocks, hence speeding up transmission.


Zmodem Crash recovery
Crash Recovery(Zmodem only)

Another nice feature of Zmodem is its ability to recover after a crash. Lets say you are in the middle of a large transfer and very close to the end. Your spouse decides to pick up the phone, interrupting your transfer. Well unless you are using Zmodem with crash recovery, all your time is wasted. Crash recovery allows you to resume a transfer right where you left off.

Note: The remote system must support this also.


Zmodem skip no files option
Skip no files(Zmodem only)

If you select this option then Zmodem will skip any incoming file that doesn’t already exist. Note: you must select the Option Override option for this to be effective.


Zmodem protocol options override
File options override (Zmodem only)

If you select this option then the senders options will be ignored.


Transfer Name collision
Name Collision

Here you determine COM’s action if you are receiving a file and it already exists on your system:

none:	do nothing.

Reject	Reject the incoming file.

Rename	Rename the incoming file. The first character in the name will begin with a $. (Script.txt will become $cript.txt)

Overwrite	Overwrite the existing file.

Note: These options do NOT apply to the Zmodem protocol. Zmodem has its own options.


Abort on DCD lost
Abort of DCD lost

With this option selected COM will abort any file transfer is the Carrier signal is lost.


RTS low for writes

If this option is checked then COM will lower the RTS signal when a disk write must be performed. You may require this if you are performing heavy disk activity while transferring files.


Include Outgoing Directory

Determines whether the transmitter sends the full file path for each file it transmitts. The receiver can ignore this information.


Honor Incoming Directory

If this option is set to true the received file will be stored in the directory specified by the sender unless the directory doesn’t exist. In this case then it is stored in the Download Directory or the home directory of COM.


Zmodem Auto start

COM has a feature that allows the receiving end to sense when the sending end starts a file transfer. This allows the receiver to automatically start a download.


Flow Control

Flow control allows either the transmitter or receiver to limit the flow of information. This is needed because the receiver may not be able to accept the serial data as fast as it is being received.

There are two main types of flow control (or handshaking).

Hardware:  Hardware handshaking uses control lines of the serial link to control the flow of information. This is the preferred type in most situations.

Software:  Software flow control uses control characters to control the flow of information. This type is sometimes referred to as Xon/Xoff flow control. The way this works is the receiver will send the Xoff character (typically ASCII 19) to stop the transmitter. When the receiver is ready to start receiving information it will send the Xon character (typically 17). This tells the transmitter to start sending again.

Without flow control it would be very easy for the receiving end to overflow the input buffer resulting in a loss of data.

By default Com sets flow control to hardware.


This is the oldest (or near) file protocol out there. Xmodem is very simple and slow. It transfers data in 128 Byte blocks then waits for an acknowledgment from the receiving system.


This is basically the same protocol as Xmodem except that a CRC (Cyclic redundancy check) has been added to the protocol making it a little more reliable.


This is another mutation of the Xmodem protocol. This version uses 1024 byte data blocks and CRC checking. This is a much faster protocol than regular Xmodem.


This protocol is basically Xmodem1K with a new feature. It allows multiple files to be transferred, one after another. This is called a batch protocol. Another plus is that the transmitter supplies the filename, size and date information to the receiver.


This is a very fast mutation of YMODEM. It is a streaming protocol that does not perform error checking. It relies on the modem to perform any error correction. You should not even try this protocol unless your modem supports error correction.


Is probably the most popular file transfer protocol there is. It is almost as fast as YMODEMG, and can easily recover from errors. It even allows interrupted file transfers to be continued at a later time. This is probably the protocol you should use.


This protocol was made to handle file transfers under special  conditions. Conditions like serial data bits of only 7 bits, and transferring between mainframe computers and PCs.


CompuServe B+ is a protocol that is only used by the on-line service CompuServe. Com only supports the B+ version.


Scripting

See the Script Referencefor more info

Scripting is a way automatically execute instructions depending upon prompts received from the remote session. A good example of this is logging into a BBS. You are prompted for your name or user ID and then prompted for a password. You could have Com watch for these prompts and send your name and password automatically. Suppose you are logging in to a system that prompts you for login information like this:

What is your first name: <Tod>

What is your last name: <Liverseed>

You could make a script like this:

; Wait for the first name prompt for 20 seconds.

Wait ‘first name’ 20000

;Check for success. If not then exit script

If fail error

;Send your name.

send ‘Tod’

;Wait for the last name prompt for 5 seconds.

Wait ‘last name’ 5000

;Exit script if prompt not found in 5 seconds.

if fail error

;Send last name.

send ‘Liverseed’

;Label

:error


Script Reference

:<label>

;<comment>

INITPORT   <COM1..COM9> <baud>

DONEPORT

SEND     'XXXXXX'

WAIT     'XXXXX' <timeout in ticks>

IF       SUCCESS/TIMEOUT/FAIL  <label>

WAITMULTI  'XXX|ZZZ|YYY', <timeout in ticks>

IF       1/2/3...127 <label>

GOTO     <label>

DISPLAY  'Just did something'

SENDBREAK  <duration in ticks>

DELAY      <duration in ticks>

SET      <option> <data>

    RETRY  <data>

    DIRECTORY <drive:directory>

    FILEMASK <filemask>

    FILENAME <filename>

    WRITEFAIL

    WRITERENAME

    WRITEANYWAY

    ZWRITECLOBBER

    ZWRITEPROTECT

    ZWRITENEWER

    ZSKIPNOFILE <true/false>

UPLOAD       <protocol>

DOWNLOAD   <protocol>

CHDIR      <drive:directory>

DELETE     <filemask>


:<label>

A point in the script file that can be jumped to via a GOTO or IFinstruction. A label name can be any type of string without embeddedspaces. For example ':TopOfLoop', ':TOP_OF_LOOP' are both acceptable;':top of loop' is not.


;<comment>

Any line that starts with a semicolon is considered a comment. Blanklines are also considered comments and may be freely added forreadability.


INITPORT   <COM1..COM9> <baud>

Open the specified port at the specified baud rate. The lineparameters are always no parity, 8 databits and 1 stop bit. Only oneport at a time may be opened.


DONEPORT

Closes a port previously opened with INITPORT.


SEND     'XXXXXX'

Transmits the string 'XXXXXX'. Control characters may transmitted by preceding a character with '^'. For example, a control C character is represented by ^C. You'll use this feature most often when sending carriage returns. For example, SEND 'myname^M' might be an appropriate response to a logon prompt where you would normally type your name and press <Enter>. NOTE: Unlike Object Pascal strings the control characters must be *inside* the quote marks, if quote marks are necessary. If the string does not contain any embedded blanks the beginning and ending quotes can be omitted. The quotes are required if the string has embedded blanks. Here are some examples to illustrate this point:

  SEND ABC      sends ABC

  SEND 'ABC'    sends ABC

  SEND A B C    sends only the A ('B C' is considered a comment)

  SEND 'A B C'  sends A B C


WAIT     'XXXXX' <timeout in ticks>

Waits up to <timeout in ticks> ticks for a particular received string. The string comparison is always case insensitive. However, the string comparison need not be complete. If, for example, a host returns the string 'Host XXXX ready' where XXXX might vary from session to session, the WAIT command should wait for 'ready' only. As with the SEND command, beginning and ending quotes are only required if the string contains embedded blanks.

This command sets one of three conditions: SUCCESS, FAIL or TIMEOUT, which can be tested with the IF command. SUCCESS is set if the string is received before the timeout. TIMEOUT is set if the timeout expires before the string is received. FAIL is set if the timeout expires and all retries are exhausted.


IF       SUCCESS/TIMEOUT/FAIL  <label>

Tests the condition set by the last command and, if the tested condition is true, jumps to <label>. If the condition is not true then execution continues with the next statement.


WAITMULTI  'XXX|ZZZ|YYY', <timeout in ticks>

Waits up to <timeout in ticks> ticks for one of several substrings. The bar character (|) separates the substrings. The comparisons are always case insensitive. The maximum length of the entire string is 255characters. As with the SEND command, beginning and ending quotes are only required if the string contains embedded blanks. This command sets a numeric condition result based on the substring received: '1' is set if the first substring is received, '2' is set if the second substring is received, and so on. If none of the strings are received then TIMEOUT is set; if all retries have been exhausted then FAIL is set.


IF       1/2/3...127 <label>

Tests the condition set by the last WAITMULTI command and, if the tested condition is true, jumps to <label>. If the condition is not true then execution continues with the next statement.

The following example sends a modem dial command, then waits for one of CONNECT, NO CARRIER, or BUSY responses. If none of the responses are received then control falls through to the GOTO statement:

  send 'atdt260-9726^m'

  waitmulti 'connect|no carrier|busy' 1092

  if 1 HandleConnect

  if 2 HandleNoConnect

  if 3 HandleBusy

  goto HandleTimeout

  :HandleConnect

    ...proceed with session

  :HandleNoConnect

    ...handle noconnect error

  :HandleBusy

    ...handle busy error

  ...


GOTO     <label>

Unconditionally jumps to <label>.


DISPLAY  'Just did something'

Generates a call to the TApdScript component's OnScriptDisplay eventhandler. If the DisplayToTerminal property is True and a terminal component exists on the form then the string is also displayed to the terminal. This can be used to monitor the progress of the script and to aid in debugging.


SENDBREAK  <duration in ticks>

Transmit a break of <duration in ticks> ticks.


DELAY      <duration in ticks>

Delays for <duration in ticks> ticks. The script doesn't yield during delays so keep the delays as short as possible.


SET      <option> <data>

Sets or resets a variety of script and protocol options. Some options require a <data> argument; some do not.


   RETRY  <data>

  Sets an internal retry count that is incremented whenever WAIT or  WAITMULTI result in a TIMEOUT condition. When <retry count> TIMEOUTs  have occurred the FAIL condition is set. The default is 1, meaning  no retries are attempted.


   DIRECTORY <drive:directory>

  Sets the destination directory used during protocol receives.


   FILEMASK <filemask>

  Sets the file mask used during protocol transfers. For non-batch  protocols this must be a specific file name rather than a mask


   FILENAME <filename>

  Sets the received file name for protocols that do not transfer the  file name (all Xmodem protocols).


   WRITEFAIL

  Sets the WriteFailAction property to wfWriteFail for all protocols  except Zmodem -- meaning that if an incoming file already exists the  incoming file is skipped.


   WRITERENAME

  Sets the WriteFailAction property to wfWriteRename for all protocols  except Zmodem -- meaning that if an incoming file already exists the  incoming file is renamed (the first character of the file name is  replaced with $).


   WRITEANYWAY

  Sets the WriteFailAction property to wfWriteAnyway for all protocols  except Zmodem -- meaning that if an incoming file already exists the existing file is overwritten.


   ZWRITECLOBBER

  Sets the ZmodemFileOption property to zfoWriteClobber -- meaning that  if an incoming file already exists the existing file is overwritten.


   ZWRITEPROTECT

  Sets the ZmodemFileOption property to zfWriteProtect option --  meaning that if an incoming file already exists the incoming file is skipped.


   ZWRITENEWER

  Sets the ZmodemFileOption property to zfWriteNewer option -- meaning that if an incoming file already exists the existing file is overwritten only if the incoming file is newer.


   ZSKIPNOFILE <true/false>

  Sets the ZmodemSkipNoFile property to True or False. When this option is True incoming files are skipped if they do *not* already exist on the receiving machine.


UPLOAD       <protocol>

Starts transmitting files using <protocol>. <protocol> must be one ofXMODEM, XMODEM1K, XMODEM1KG, YMODEM, YMODEMG, ZMODEM or KERMIT. All files matching the mask previously specified by SET FILEMASK are transmitted.


DOWNLOAD   <protocol>

Starts receiving files using <protocol>. <protocol> must be one of XMODEM, XMODEM1K, XMODEM1KG, YMODEM, YMODEMG, ZMODEM or KERMIT. If using any of the Xmodem protocols you must call SET FILENAME before DOWNLOAD to specify the name of the received file.


CHDIR      <drive:directory>

Changes the current drive and/or directory to the one specified by<drive:directory>. If the drive or directory does not exist the FAIL condition is set.


DELETE     <filemask>

Deletes all files matching <filemask>. If no path is specified the current directory is used.


Ticks

System Bios clock ticks. About 18.2 ticks per second


Adding an Entry

Adding an new BBS system is quite easy.

1.	Just go to the phone book window.

2.	Press the NEW button.

3.	Type in a name for the new Entry.

4.	If you want COM to dial a phone number type it in next.

5.	Select the modem or comport you want to use. Com will take its best guess as to the port you want to use.

6.	Set up any special file transfer settings or communications settings.

7.	Press OK and your done.


Deleting an Entry

Deleting an entry from the phone book is quite easy. Don’t worry, you cant delete any files from your computer by doing this!

1.	Select the entry you want to delete.

2.	Press the DELETE button (not the key).

3.	All done.


Changing entry's properties
Changing an Entry’s properties.

You can change any property you wish of your entry (except its name!). Just select the entry you wish to change, press the property button and do your work.

Special note:  You cannot change your entry’s communications properties while you are online. You must do this off-line. You are allowed to change file transfer protocol settings while online via the Transfer menu.


Dialing an entry

Dialing an entry is pretty self explanatory. Select the entry to dial and either press the dial button or double click on the entry. If COM senses that it has connected to another computer it will then run the startup script if it is specified. This allows for auto logins and automating simple tasks.

Other dialing options:

There are some special conditions though. Entries that have the Auto Answer enabled will NOT dial a phone number even if one is present.

You can also drop to what I call local mode by first selecting a Direct to COMx modem type. Then leave the phone number blank. Not when you ‘dial’ this entry you will be connected to your modem in local mode.


Auto Answer mode

Auto answer mode allows you to set your machine up as a simple host. When COM detects an incoming ring it will automatically answer the phone and start a handshake sequence with the calling computer. This is handy for transferring files between work or your friends etc.

To make an entry answer the phone just edit the entry’s properties and check the Auto answer check box. When this entry is dialed it will start listening for incoming calls, regardless of whether there is a phone number specified or not.

When COM connects to an incoming computer it will run the startup scriptscript_jump, if any. This would be useful for automating file transfers etc.


Handshaking is the procedure modems talk to each other and negotiate common options. Basically the handshake is where the two modems aggree upon how they will talk to eachother.


The Terminal Window

COM’s terminal window is where your entire session is displayed. Most everything happens here. There are quite a few settings that you can change to suit the window to your liking.  I guess the easiest way to explain these settings is go right down the terminal menu.

Font

Background

Doorway

Terminal Emulation

Key Emulation

Local Echo

Capture Session

Copy

Paste


Paste

I don’t think I really need to explain this one… Any text in the clipboard will be pasted to the terminal AND the comport. So it will go to the remote system as well.


Copy

Basically works the same as any ‘copy’ function. Just select the text and select this. The text will be copied to the clipboard.


Capture Session

You may record your entire session with this option. When you select this you will be asked for the filename you wish to save the session. COM will then record everything from the screen to the file until you tell it to stop.


Local Echo

This options causes COM to echo back to the terminal screen any characters you type. Most systems echo back your key strokes automatically. So if you see two of everything you type then try disabling this option. This is handy for, say, direct connects between two terminal programs.


Key Emulation \

This is very similar in meaning to Terminal emulation. Different systems require different data bytes for the same keys… no… ‘A’ is not always an ‘A’, well not all the time at least. Just be sure to set your emulation to the same as the remote system.


Terminal Emulation

There are more that one way to display incoming information in COM’s terminal window. Most BBS systems use ANSI or ANSI BBS emulation. When connecting to larger file servers or mainframes then the choice is usually VT100 or VT52. Most remote systems will allow you to choose the emulation you want to use. Just BE SUIRE that you both are using the same emulation!


Doorway Mode

This is a special emulation mode. In the simplest terms it sends key strokes to the remote system just as if it were receiving them from a local keyboard. This means that you can send, for instance, the ‘Alt F’ key sequence. F1-F12 also work just fine. Page up/Page down/Home/End… they all work! Not very many Windows communications programs offer this kind of emulation or control.


Background Colors

This allows you to change the background color of Com’s terminal window. Note: Changing this clears the entire window.


Terminal Font

You may specify the font you wish to display in the terminal window. You probably will notice that not all fonts are listed. Most true type fonts are not listed etc. This is because of the nature of the terminal window. You should also note that the ‘Terminal’ font is usually the font of choice. This is the Only windows font that displays ANSI graphics correctly. So if you see your graphics not looking quite right, this is most likely the cause.