TCP/IP applications for your PC compatible retro-computers
Current version: July 5th, 2015
A blatant interruption for something not related to mTCP !
online garage sale: Help me
clean thin out the vintage computer collection !
mTCP is a set of TCP/IP applications for personal computers running
PC-DOS, MS-DOS, FreeDOS, and other flavors of DOS. The applications
mTCP should run on all variants of DOS including IBM PC-DOS, Microsoft MS-DOS, DR-DOS and FreeDOS. All of these applications will run well on the oldest, slowest PC that you can find - I routinely use them on an IBM PCjr made in 1983 because nothing beats the fun of putting a 30+ year old computer on the Internet.
People are using mTCP for goofing off and for real work. If you have a DOS machine that needs to send data across the network mTCP can help you get that done. Besides its utility to vintage computers I have heard of people using it to transfer lab data from dedicated industrial PCs, allowing backups to be run on old machines, and sending sales reports from the branch offices of a retail store to a central server.
Don't have a vintage computer laying around? No problem! mTCP applications will run in a variety of virtual and emulated environments. It has been tested with DOSBox, SwsVpkt, VirtualBox and VMWare. See the documentation for the details.
mTCP applications should work on any IBM PC compatible personal computer running DOS. To be more specific:
A packet driver is a utility that lets a program send and receive Ethernet packets using your network card. The packet driver specification is widely supported by both old and new Ethernet cards. If your Ethernet card does not have a packet driver available an NDIS or ODI driver with a "shim" to convert to the packet specification should work but that will require more memory and be slower than having a real packet driver. SLIP and PPP connections are also supported if they use a packet driver that emulates Ethernet. See http://www.crynwr.com/packet_driver.html for more information on the packet driver specification.
My personal testing includes:
This is the official mTCP home page. The code used to be available
at code.google.com, but as that is shutting down I have moved
everything back here again. There are other sites that
mTCP but only this page guaranteed to have the original, unmodified
Two sets of files are available:
|mTCP_2015-07-05.zip||Standard binaries||The mTCP applications and sample files|
|mTCP_2015-07-05_upx.zip||UPX compressed binaries||The same applications and sample files as above, but compressed to take less space on disk. These are useful for systems without a hard drive.|
||A single PDF file with all of
|Previous version: Open source under the GPLv3 license
|mTCP_2013-05-23.zip||Standard binaries||The mTCP applications, sample files and user documentation.|
|mTCP_2013-05-23_upx.zip||UPX compressed binaries||The same mTCP applications, sample files and user documentation as above but compressed to take less space on disk. These are useful for systems without a hard drive.|
|mTCP-src_2013-05-23.zip||Source code||The source code to mTCP with design documentation and notes.|
Interested in getting started but want to learn more? Please see my
page on DOS networking using packet drivers: http://www.brutman.com/Dos_Networking/dos_networking.html
mTCP is a hobby project that I started in 2005. While it is only a hobby project, I take pride in my work. If you have a comment, bug, or suggestion for a feature please email me at mbbrutman at gmail.com. I might ask for further information or a trace from the program you are having trouble with. Your bug reports help me make mTCP better for everybody else.
If you need a change to make mTCP work better for you I am
interested in hearing your requirements. I am willing to write custom
code if needed, but instead of charging for that service I suggest
making a donation to a local animal shelter of your choice. (I have
never seen an over-funded animal shelter.) Contact me with what you
need and I'll see what I can do. (And thank you to those who have taken
me up on this offer!)
Interested in seeing the source code that lets you talk directly to a packet driver? I have taken the lowest layer of the mTCP code and packaged it with a sample application that shows you how to interface a C program with the software interrupt mechanism used by packet drivers. Check it out here: mTCP_tcpacket.html
(Note: The current version of mTCP
is not available as open source yet. If you are interested in working
with the mTCP source code the 2013-05-23 version is available to use.)
All of the applications use the mTCP TCP/IP library which is designed for high performance even on small, slower machines. The code is written in a combination of C++ and assembler. The style of coding is more like "C with classes" to improve the structure of the code with assembler being used in limited areas to improve the performance. The source code is fairly well commented. You can look at it as a framework for writing TCP/IP applications for DOS, complete with plenty of examples.
Features include ARP, UDP, DNS, IP fragments, listen and accept calls for server applications, configurable buffer sizes, automatic retransmit using Karne's algorithm, and run-time switchable tracing for helping you debug. Features may be compiled in or out as needed so that you can minimize the overhead of the TCP/IP library and include only the features that you need. mTCP does not use floating point operations, avoiding the code bloat of the floating point emulation library.
mTCP is designed to be robust. DOS is a challenging environment to work in because quite frankly, it is not much of an operating system. mTCP attempts to minimize problems by using defensive programming techniques. Not every programming error can be prevented, but the library tries to help you where it can. For example, to prevent fragmentation in the DOS heap mTCP generally preallocates pools of objects and manages the objects instead of repeatedly allocating and freeing memory using the DOS heap. The FTP server and the IRC client have been demonstrated to run for days without leaking memory or crashing the machine.
High performance is a key feature of mTCP. The library is written to avoid excess memory copying wherever possible. Assembler is used on some code for both performance and to avoid making expensive library calls that will just invoke BIOS or DOS routines anyway. For the ultimate in performance you can choose to handle raw packets directly in your application layer code, or you can use higher level "send" and "recv" type calls instead. The ability to adjust buffer sizes allows you to balance speed versus memory footprint. Want to see how fast mTCP is? Here are some performance measurements for FTP and for raw socket performance: mTCP Performance notes
mTCP is only available as a library that you link with your application. A TSR version that can be used by software interrupt is not available. While a TSR version would allow more programming environments access to TCP/IP services, it is a much more difficult environment to work in and debug. Performance would also suffer too. It would be an interesting project though - if you want to collaborate on the design for a TSR version of mTCP please contact me.
(For a TCP/IP stack that loads as a TSR see Trumpet by Peter Tattam. Trumpet can usually be found by searching for TCPDRV or NTCPDRV. WATTCP is an older, more widespread TCP/IP stack that can be used as an alternative to mTCP. Neither Trumpet or WATTCP are actively maintained.)
mTCP is developed using Open Watcom, an open source tool chain that supports C, C++, and assembler. Open Watcom is flexible and generates reasonably optimized code. Open Watcom also runs under modern environments such as Windows and Linux so you can develop in the environment of your choice while still generating 16 bit DOS executables. Open Watcom is regularly updated; mTCP is using version 1.9 which was released in June 2010. Porting to other environments such as Borland Turbo C++ for DOS is possible without too much pain. (mTCP originally started with Borland Turbo C++ for DOS.)