Skip to content(if available)orjump to list(if available)

mTCP: TCP/IP applications for DOS PCs


For those of you missing context, mTCP is a TCP/IP library and some of the more common applications. It runs on anything from an old 41 year old IBM PC up to emulated virtual machines.

Applications include fresh implementations of a DHCP client, FTP client and server, HTTP server, IRC client, Telnet Client, SNTP client, Ping, and some other goodies. (These are not stale ports of old code.) Everything runs in 16 bit DOS and the library is open source.

The target is retro-computing hobbyists and people stuck with embedded solutions that use DOS. A good FTP client can be a godsend in that situation.


Didn't see mention of it in the release notes but did you happen to implement the ability to disable the ftp server login beep via the config file. We exchanged some email regarding this a while ago. If I forget to do so manually the beep sends my dog into a barking frenzy when I connect. You mentioned implementing for the next version.


Ouch - I thought I had it and I missed it. I'll email you a patched version.


Would the core be patched ?


Thanks a ton Mike! One of these days I want to start working on a djgpp version of the library code. 32-bit clients could be useful for some things.


Does each application implement its own tcp up stack? Or does dos have one already?


Each program is linked against a TCP/IP library. #defines control what parts each program gets, depending on what it needs.

The DOS TSR approach would make TCP/IP a common service for DOS programs. I went with the library approach for speed and customization purposes.


I'll spread the word to the guy maintaining some tools (RIE, wire bonder and mechanical profilometer) running DOS in our university micro-nano fabrication center. Hope it can help extending the useful life of those >20k$ equipment a bit.


for people who want to try this with real hardware I would recommend the 3com 3c503 as the best choice of 16-bit ISA bus interface card. Or a real NE2000. There were some weird NE2000 clones back in the day that were not so great.


I use the 3C503 in a lot of machines. It is not a great performer, but it is well supported and solid. And it is an 8 bit card, which is handy for the older PC and XT class machines.

Other notable cards for older machines include the NE1000 (8 bit), NE2000, Intel 8/16, Western Digital or SMC 8000 series. Many PCI cards work well; just look for a packet driver. For those of you without real slots the Xircom PE3-10BT device is great, but they are getting more expensive in the wild.

SLIP and PPP work. PLIP works too, but I have not tested it myself.

And there are even packet drivers that allow for Token Ring and Arcnet to be used; they emulate Ethernet.


I have a few cheap noname NE2000 clones that I originally got in the mid 90s. I wouldn't have put them in a server but they were stable for me in DOS, 16 bit Windows, OS/2 and eventually Linux clients back in the day. Linux had some growing pains with the NE2000 drivers. I wouldn't have put them in a server but they always worked great for my home client machines. They still work great for me today in my retro machines. I use them with packet, ODI and NDIS drivers with no issue.

I also have a real NE1000 that I use in a Zenith Z-161 luggable, an XT class 8-bit isa machine. This is the machine I mostly use mTCP on.



I'm sort of curious what the best choice is for wireless on that tier of hardware. I sort of want to use the NTP client rather than waste a slot for a clock card, but I don't think I'm going to have a good spot with Ethernet access for the machine.

Seems like the common consensus is $10 scrapyard NIC plus Wi-Fi bridge. TBH, I was always surprised that the consumer Wi-Fi bridge was never a popular thing. You'd think it would sell more easily to customers, because most PCs have had Ethernet on board since like 2000, and even adding a USB dongle means having to bring new drivers in.

Now going full off tangent-- what happened to old wireless client hardware? If you go into any thrift shop, you're going to see a bunch of old 802.11g or n routers, but you usually don't see the adapters. I could see internal ones being scrapped with the PCs they were in, but I'd expect people who bought a new-spec router and matching adapter would replace them together.


in the era of 802.11b and 802.11g being the hottest and greatest thing for wireless clients, there were very few desktop PCs equipped with interface cards for it.

generally it was built into laptops for 95% of the clients... Your typical Dell business laptop from the year 2000 came with a minipci slot and a 2.4 GHz antenna cable, populating the slot with an 802.11b card was an option.

or something like the original apple airport wireless AP and the wifi 802.11b built into macbooks from the era.

or in an even earlier era you would find like PCMCIA/PC Card type 2 or type 3 interfaces with an 802.11b radio and antenna in them to stick out the side of your laptop.


It is also possible to use a 3c509 in 8-bit ISA mode. Such a card might be easier to get hold of these days.


My number two software after Volkov Commander (thank you Seva) when I build an vintage gaming pc, great thing to have a easy way to transfer files to old DOS machine. mTCP rocks !


Great toolset. This was essential once I got my revived 386 luggable going in order to get all sorts of software and files back and forth with the FTP server.


Just read your bit on how focused you felt using that. Very interesting!

I still have my ATX big case pc and won't give it up for a laptop even though it makes no sense (well it does in that I can upgrade bits as I please).

However for the most part I associate computers with work and stress these days.


This is wonderful to see! Wow.

Reminds me of that era, when office computers didn't support TCP/IP at the system level: applications had to implement their own stack.

1990s-me used NCSA Telnet on the Mac every day.

Once Windows Sockets API was nailed down, a good TCP/IP stack was available on DOS as a system network driver. And IIRC Apple released a system service as well, as a System extension and Control Panel.


I discovered NCSA Telnet late, after it was obsolete, but it inspired me greatly. I still have not looked at the source code, but it is tucked away somewhere.


Is there like a long form intro somewhere that starts at a packet driver and a virtual machine and takes you through the internet stack that way?

I'm not sure if that's stupid, but I've done a lot of things with raw ethernet frames, and used LWIP, but...I'd like to develop my own someday, just to "know" how it's all really supposed to work.


I remember submitting an nmap-profile for a DOS-era TCP/IP stack about 20 years ago... it would crash every time you scanned it.


The tagline ”Friends don't let friends run old code” on their page was rather funny, considering it’s targeted towards DOS users


My jokes don't always land well. I'll consider this a success.

I prefer to look at DOS as "stable."


> considering it’s targeted towards DOS users

I don't see the connection. Is this a reference to something from the 80s?


DOS is old code, so the humor comes from the paradoxial juxtaposition of touting the use of old code while simultaneously saying, "friends don't let friends run old code."

This superposition of statements is set against the backdrop of the tech idiom, "friends don't let friends" followed by some activity. [1]

This tech idiom is based on a decades-old advertising slogan, "Friends Don't Let Friends Drive Drunk," by MADD, Mother's Against Drunk Drivers. [2]




> DOS is old code

Not necessarily!


Well, considering the last DOS version is 6.22 (or, if you stretch, Windows ME)... by virtue of running DOS, you're running old software almost by definition :) Yes, I know FreeDOS exists.


There were a few versions of DOS from other vendors available after MS-DOS for example IBM PC-DOS and DR/Novell/Caldera (same OS with name changes as the owner changed) DOS.


It comes from C++, an object oriented programming language where friends don't let friends access their privates. A nerd joke basically.


Wow! Will you eventually implement multithreading?


Probably not .. that is a diminishing returns kind of thing. If I'm the only user and there are not a lot of programs that need it, it's not worth the effort.

What I have now can best be described as cooperative multitasking with custom contexts. Example: the FTP server and HTTP server keep track of each user connection, provide them a buffer, and know the state of the session and how far into the file they are that is being transferred. (True multithreading would generalize that kind of context as a set of registers and a stack for each thread.)


I am talking about actual multithreading using several cores. You don't need to write a scheduler for that or anything fancy.

There's some osdev tutorials about how to enable multiple cores in DOS, iirc. I can dig them out, if you want. You're probably seriously overthinking this.

Right now you're polling, which is fine, because that's how all the high performance software works. One thread pre core, each thread rolling through a list of connections, checking if there's new data.


Oh, I understood - I've been a professional programmer for close to 30 years, and I've done a lot of operating systems work.

On this platform you have the burden of ensuring that the C runtime is thread safe, or putting locks around it. The same with BIOS calls. And DOS function calls too; you can't have those other CPU cores just blundering in on something that is not reentrant.

And besides, I target this at 16 bit DOS on vintage machines. I've never seen a PCjr or an AT class machine with multiple cores. There were some super expensive 386s at the time that were multi-processors, but those are a fairly rare item.


Oh, multithreading? You want KA9Q NOS


Does it actually support multiple cores on modern machines?

DOS isn't fully dead yet. I was assuming his code actually runs on modern machines.