TCP/IP Networking on
DOS
Why on Earth would anybody want
to do that?
Table of Contents
Introduction
Long before there were Windows or Macs there was DOS. And even before
DOS there was TCP/IP. And even before that there was a desire for
communication.
DOS is a pretty limited environment. Most DOS machines do not have a
lot of memory and the software is pretty simple. If you needed to
communicate with a DOS machine you generally loaded up a special
program (a terminal emulator) and dialed to another system
using a modem. Although Ethernet has existed for many years, it almost
never appeared in the home until the mid to late 1990s when people
finally got tired of walking around with floppy disks. And by then,
Windows had firmly replaced DOS.
Even though DOS is obsolete you can still use it to run TCP/IP and
communicate with other machines. TCP/IP takes quite a bit more memory
and CPU than a plain old terminal emulator using a modem but when used
with an Ethernet card it can be far far faster than the old modem
technique. Just to illustrate that point: a serial port on an old
machine might be able to transfer anywhere from 9600 to 115200 bits per
second, while an Ethernet card on the oldest PC I can find can transfer
over 50,000 bytes per second!
DOS is probably not what you want to 'surf the web' with although there
are bragging rights associated with having an old IBM PC XT directly
connected to the Internet via a cable modem or firewall. You can still
use telnet and FTP, but web browsing is going to be painful ... save
that for the bigger machines.
Networking with DOS satisfies the urge to do something that wasn't
meant to be done. And at least for file transfers within the home, it
sure beats walking around with 5.25 inch floppies!
What is TCP/IP?
TCP/IP is a collection of protocols designed to allow higher level
applications to send and receive data over a network. At a
very high level, it allows programs to open connections to other
programs on different machines across the network. At a very
low level it is just a mechanism for sending data across hardware.
TCP/IP is layered into several parts:
- IP: This is the lowest layer. IP packets
are
transmitted over your networking hardware. IP packets are not
guaranteed to arrive in the order they were transmitted, or arrive at
all! IP packets are sent to machines or groups of machines.
- UDP: UDP is a higher level protocol that uses IP
packets.
UDP adds the concept of 'ports' to the communications stack
so that a packet doesn't just target a machine anymore, it can target
an application running on that machine listening to a specific port.
UDP packets are not guaranteed to arrive in order or arrive
at all either. Each UDP packet is a self contained unit, like
a single piece of mail.
- TCP: TCP is another high level protocol that uses IP
packets. TCP uses ports to establish a 'connection' between
applications on two different machines, each using a port.
Packets are guaranteed to arrive, and in order too.
TCP can be thought of more like a telelphone call, as opposed
to UDP which behaves more like a posted letter.
TCP/IP is fairly complicated, especially the TCP part. A full blown
implementation requires more memory than is usual on an old DOS PC.
With some limitations and some features cut out, you can get a
reasonable amount of TCP/IP to operate on an old DOS PC with good
performance. If you cut a lot of corners you can squeeze TCP/IP into a
very small amount of memory, but the performance will suffer.
On a DOS PC there are generally two ways to run TCP/IP:
- TCP/IP is built into an application, such as with NCSA
Telnet or Minuet.
- TCP/IP is a TSR (Terminate and Stay Resident) program
loaded as a separate piece of software from the final application. The
application accesses TCP/IP through a software interrupt. (Trumpet)
The first approach works well for 'all-in-one' programs like NCSA
Telnet, which also has an FTP server built into it. The second approach
is more flexible and lets you right your own TCP/IP applications
because the TCP/IP part is a separate entity.
A
Warning About DOS
If you are not comfortable installing new hardware into your machine,
editing config.sys, or trying to debug hardware that hasn't been
supported in 15 years, then TCP/IP in DOS is not for you. At
a minimum you are going to have to:
- Install your Ethernet hardware. This implies successfully
avoiding IRQ and port conflicts
- Find the right packet driver and parameters
- Possibly debug your network setup
On the other hand, the rewards are well worth it. Blasting files around
the house at speeds ranging from 20KB per second (on a slow machine
with a parallel-port Ethernet adapter) to 600KB per second (on a high
end 386 with a 16 bit NE2000 compatible adapter) sure beats the heck
out of 'sneakernet.'
Hardware
and Packet drivers
TCP/IP is a general protocol that can run over many types of networks:
In general, we will restrict this discussion to the more conventional
networks.
To connect to a network you need hardware. There are lots of
solutions out there - here are a few examples:
- A network card. This is a card that plugs
into
the bus on your machine. There are many manufacturers and
varieties of cards. Ethernet is the most popular type of
network card. Token Ring was quite capable but has been
abandoned because Ethernet hardware is so prevalent. Earlier
networking technologies such as Arcnet, IBM Cluster, IBM PC Network,
etc. are possible too but might not be supported for what you are
trying to do.
- Serial or parallel port: The serial or parallel port
allow
you to connect directly to another machine, which makes a very small
network of two machines. Dial-up internet services basically
work this way. (The machine you are dialing to is a gateway
to other machines, which broadens your perceived network.)
- Parallel port-to-Ethernet adapters: These are real
Ethernet
adapters that attach using your machine's parallel port instead of
plugging into a bus slot. These are useful if your need is
temporary or you have no available slots to use.
Any hardware that you choose should have a 'packet driver'. A
packet driver is a DOS terminate and stay resident program that
provides a standard programming API for using a specific ethernet card.
If you have TCP/IP software that works with the packet
interface, then it will work with any hardware that has a packet
driver. If your network hardware does not have a packet
driver, you need to find software that knows how to talk directly to
the hardware.
Click here for a
detailed discussion of packet drivers.
Choosing
Hardware
There are lots of factors that go into choosing networking hardware.
Here is my set of criteria:
- Can I get the hardware for my machine? A
machine
with a 16 bit ISA bus or PCI bus is easy to find hardware for.
A machine with 8 bit PC bus slots or non-standard slots is
much more difficult to find networking hardware for.
- Does the selected hardware have a good packet driver?
A good packet driver not only makes the card work, but it
affects performance. Many packet drivers can be found here.
The packet driver programming specification can be found here.
Finally, older hardware might come with packet drivers on a diskette
included with the hardware.
- Can I connect it to my network? Newer cards
use
twisted pair wiring with the familiar RJ45 connector. Before
twisted pair was standardized there were non-standard cards that used
twisted pair, there was 'Thinnet', and there was 'Thicknet'.
Be prepared to dive into the world of AUI adapters, BNC
jacks, transceivers, hubs and switches.
For 16 bit ISA bus machines you can use nearly anything. I
would look for a card from a well-known manufacturer with an RJ45
connector and a good packet driver. 3Com, Intel, and
NE2000 compatible cards are safe bets.
For 8 bit ISA bus machines your choices are more limited. The 3Com
3C503 based cards are usable. Western Digital/SMC 8003 based
cards and NE1000 cards are good as well. I have not experienced
one but I have read in many places that if you find a 3Com
3C501 based card
that you should burn it and bury it. Some 16 bit cards might
be able to function in an 8 bit slot, but you will have to experiment
with that.
For machines without slots or where you want a temporary solution I
would use a parallel-port to Ethernet adapter. The Xircom
PE3-10BT is a good example of this type of adapter. It
connects to the machine using the parallel port and the packet driver
makes it look just like a real Ethernet card. But the
overhead of the parallel port does hurt performance, so while it is a
good basic solution it will never beat the performance of a real
Ethernet card.
Of course you might have a machine new enough to have PCI slots. If you
are running DOS on such a high powered machine, I applaud you. :-)
Look for an older model Ethernet card with DOS packet drivers
and you will be fine.
Created August
13th 2007
last updated July 31st, 2008
(C)opyright
Michael B.
Brutman, mbbrutman@yahoo.com