VOGONS


Old TCP/IP networking

Topic actions

First post, by mike_canada

User metadata
Rank Member
Rank
Member

Seems people are going for IPV6.

But right now I'm trying to make my own TCP/IP network in pure DOS mode but I want to test it across many emulators and many computers to see if things work, but I haven't gotten past computer 1.

Sometimes my code works and sometimes it doesn't, but I'll explain in pseudo code how my software works:

Let's assume the remote IP address is known and we call it y.
The local IP address is known and we call it x.
The MTU is set to 576 and all IPV4 packets have DF set.

Here's the steps I use and what is going on:

1. x connects to y (issues empty packet with SYN set)
2. y accepts it and responds with SYN-ACK
3. x increments its sequence number and sends full HTTP request and ACK
4. y returns nothing with ACK set
5. y returns normal packet
6. y returns one more packet with PSH set
7. y returns empty packet with FIN set

I always have window at my end set to 536 because MSS = MTU - 40 (IP header size).

The problem is sometimes the connection works wonderful, but most of the time, I only get the first part of the response correct but the second part is half the time incorrect.

I don't use any advanced settings like selective acks and all that. Just the basics and advertising MSS size, that's it.

The only thing I can't figure out which no one on the internet told me is, exactly how do I set the ACK value?

Many sources state ACK value equals sequence number plus the size of the data received. And sources say add 1 to the value if SYN flag is set.

but no one told me if I should increment ACK value if FIN, RST, PSH or any other flag is set.

So for example, if the server returns ACK, FIN, and PSH (which has happened in some cases) with say 100 bytes of data and the sequence number 502, then should ack equal 604 (502 + 100 + FIN=1 + PSH=1)?

Reply 1 of 27, by Caluser2000

User metadata
Rank l33t
Rank
l33t

I just load the nic packet driver, any support files like winpkt and WinSock for MS Windows 3.x for example, then load the appropriate program/software and go..............

Telnet and FTP protocols work fine in Dos.

Easy as that....😉

There's a glitch in the matrix.
A founding member of the 286 appreciation society.
Apparently 32-bit is dead and nobody likes P4s.
Of course, as always, I'm open to correction...😉

Reply 3 of 27, by mike_canada

User metadata
Rank Member
Rank
Member
Caluser2000 wrote on 2021-08-02, 02:07:

I just load the nic packet driver, any support files like winpkt and WinSock for MS Windows 3.x for example, then load the appropriate program/software and go..............

Telnet and FTP protocols work fine in Dos.

Easy as that....😉

Except I'm making my own network driver for Duke Nukem for DOS so people with very old machines can connect to today's players so I'll need to know the back-end mechanisms of TCP/IP

Reply 5 of 27, by Caluser2000

User metadata
Rank l33t
Rank
l33t
mike_canada wrote on 2021-08-06, 23:13:
Caluser2000 wrote on 2021-08-02, 02:07:

I just load the nic packet driver, any support files like winpkt and WinSock for MS Windows 3.x for example, then load the appropriate program/software and go..............

Telnet and FTP protocols work fine in Dos.

Easy as that....😉

Except I'm making my own network driver for Duke Nukem for DOS so people with very old machines can connect to today's players so I'll need to know the back-end mechanisms of TCP/IP

Mike Brutman might be able to give you some tips. If you make a thread over at vcfed forums they will give you some ideas.

Last edited by Stiletto on 2021-08-07, 19:28. Edited 1 time in total.

There's a glitch in the matrix.
A founding member of the 286 appreciation society.
Apparently 32-bit is dead and nobody likes P4s.
Of course, as always, I'm open to correction...😉

Reply 6 of 27, by BloodyCactus

User metadata
Rank Oldbie
Rank
Oldbie

hmm duke nukem 3d like most dos stuff used IPX.. so your doing an IPX encapsulated inside TPCIP packet driver?

--/\-[ Stu : Bloody Cactus :: [ https://bloodycactus.com :: http://kråketær.com ]-/\--

Reply 7 of 27, by Stiletto

User metadata
Rank l33t++
Rank
l33t++
Caluser2000 wrote on 2021-08-07, 00:27:

Mike Brutman might be able to give you some tips. If you make a thread over at vcfed forums they will give you some ideas.

No need to go to VCFed, Mike Brutman has an account here? mbbrutman

"I see a little silhouette-o of a man, Scaramouche, Scaramouche, will you
do the Fandango!" - Queen

Stiletto

Reply 8 of 27, by Caluser2000

User metadata
Rank l33t
Rank
l33t
Stiletto wrote on 2021-08-07, 19:40:
Caluser2000 wrote on 2021-08-07, 00:27:

Mike Brutman might be able to give you some tips. If you make a thread over at vcfed forums they will give you some ideas.

No need to go to VCFed, Mike Brutman has an account here? mbbrutman

He over there more often than here.

Other members not on vogons.org will chime in as well....

There's a glitch in the matrix.
A founding member of the 286 appreciation society.
Apparently 32-bit is dead and nobody likes P4s.
Of course, as always, I'm open to correction...😉

Reply 9 of 27, by mike_canada

User metadata
Rank Member
Rank
Member
BloodyCactus wrote on 2021-08-07, 00:36:

hmm duke nukem 3d like most dos stuff used IPX.. so your doing an IPX encapsulated inside TPCIP packet driver?

In a sense, yes, except I don't need to understand IPX because duke nukem and a few other dos games use the commit driver specification for data preparation and TCP/IP and IPX are transport protocols which basically carry data from one place to another.

Reply 10 of 27, by Caluser2000

User metadata
Rank l33t
Rank
l33t

TCP/IP is routable. IPX isn't.

There's a glitch in the matrix.
A founding member of the 286 appreciation society.
Apparently 32-bit is dead and nobody likes P4s.
Of course, as always, I'm open to correction...😉

Reply 11 of 27, by Jo22

User metadata
Rank l33t++
Rank
l33t++
Caluser2000 wrote on 2021-08-12, 23:49:

TCP/IP is routable. IPX isn't.

I thought the same, but the web thinks otherwise.
Apparently, IPX/SPX is routable in some way or another.

https://itsitexperience.com/ipx-spx-protocols/

Edit: The culprit maybe lies within the NetBIOS part, which usually is used on DOS-based IPX networks.

"Time, it seems, doesn't flow. For some it's fast, for some it's slow.
In what to one race is no time at all, another race can rise and fall..." - The Minstrel

//My video channel//

Reply 12 of 27, by Caluser2000

User metadata
Rank l33t
Rank
l33t

Keh?

Just dropped my funny bone......

There's a glitch in the matrix.
A founding member of the 286 appreciation society.
Apparently 32-bit is dead and nobody likes P4s.
Of course, as always, I'm open to correction...😉

Reply 13 of 27, by mike_canada

User metadata
Rank Member
Rank
Member

I actually managed to pull it off with TCP/IP over windows sockets before in windows 9x and its DOS (no IPX) but now I gotta make a universal solution so it works in real DOS and in other OS's that can handle a virtual DOS like DOSBOX and dosemu and virtualbox etc.

This file was my starting point:
http://legacy.3drealms.com/stuff/dukenet.zip

It tells people the basic protocol to use when exchanging data with a network. The protocol is specific to the commit specification which is shared with Duke Nukem, Shadow Warrior, and I can't remember the name of the other game(s).

In the original commit driver, the transport methods are either through LAN IPX, the TEN game network, or serial port/modem.

For my driver im making for Duke Nukem, the methods are both TCP and UDP, but the user will need to specify the IP address, netmask, nameservers, and gateway.

This may automatically be done if you also download mTCP networking tools and run its DHCP utility provided you have a DOS packet driver installed for your network card and the device your card connects to is one that can supply IP addresses (such as your router or even your ISP). If you do the steps right, DHCP utility will show "Good news everyone!" and show your IP address.

Now if I can get a few wrinkles in my driver sorted out, then I could turn my computer into a full-fledged networked duke nukem gaming system just by flicking on the computer and everything would load in a matter of seconds. Why seconds? because then the windows junk wouldn't need to load.

Reply 14 of 27, by mbbrutman

User metadata
Rank Member
Rank
Member
Caluser2000 wrote on 2021-08-07, 19:48:
Stiletto wrote on 2021-08-07, 19:40:
Caluser2000 wrote on 2021-08-07, 00:27:

Mike Brutman might be able to give you some tips. If you make a thread over at vcfed forums they will give you some ideas.

No need to go to VCFed, Mike Brutman has an account here? mbbrutman

He over there more often than here.

Other members not on vogons.org will chime in as well....

Actually, I lurk here just about as much as I do at vcfed ... (I was a moderator there, but I've scaled back.)

I've been having email conversations with mike_canada for a few weeks on and off now. What he is doing is challenging, but all of the requirements and algorithms for implementing TCP/IP are published and well known. mTCP is also open source and it's all there for the taking too.

Reply 15 of 27, by mike_canada

User metadata
Rank Member
Rank
Member
mbbrutman wrote on 2021-08-13, 19:49:
Caluser2000 wrote on 2021-08-07, 19:48:
Stiletto wrote on 2021-08-07, 19:40:

No need to go to VCFed, Mike Brutman has an account here? mbbrutman

He over there more often than here.

Other members not on vogons.org will chime in as well....

Actually, I lurk here just about as much as I do at vcfed ... (I was a moderator there, but I've scaled back.)

I've been having email conversations with mike_canada for a few weeks on and off now. What he is doing is challenging, but all of the requirements and algorithms for implementing TCP/IP are published and well known. mTCP is also open source and it's all there for the taking too.

I do salute brutman for being one of the few guys to reply in a timely manner.

Anyways, the TCP/IP part I have mostly under control. Next step is to connect to people via UDP and since I have a few computers at home, I can create a multi-person simulation environment and test on that.

Once I'm successful there, then I have to somehow make this compatible with Windows 7+ since those OS'es has NO direct support for DOS or 16-bit windows applications. So I'll need to work out a way to make a hard drive image file programmatically that virtual box will happily accept because each time the game is run, there will likely be a different configuration since players will play different maps and connect to different people and part of that will need to be injected into the image because there's no way MS-DOS can connect directly to a windows 7+ OS on the same machine.

Reply 16 of 27, by jmarsh

User metadata
Rank Oldbie
Rank
Oldbie

I think you might run into trouble using UDP.
Even though IPX didn't guarantee reliable delivery (same as UDP), in practice it was fairly safe and a lot of games that used it assumed there would be no (or at least very little) packet loss. They also tended to "spam" lots of little packets very frequently without any sort of collation (the sort of behaviour the Nagle algorithm was designed to reduce for TCP) and expected them to arrive complete and in order.
Both of these issues can occur with UDP, especially when there's a large amount of hops between the destination and source e.g. a trans-continental connection rather than a simple dorm room LAN.

Reply 17 of 27, by mike_canada

User metadata
Rank Member
Rank
Member
jmarsh wrote on 2021-08-14, 00:00:

Even though IPX didn't guarantee reliable delivery (same as UDP), in practice it was fairly safe and a lot of games that used it assumed there would be no (or at least very little) packet loss. They also tended to "spam" lots of little packets very frequently without any sort of collation (the sort of behaviour the Nagle algorithm was designed to reduce for TCP) and expected them to arrive complete and in order.
Both of these issues can occur with UDP, especially when there's a large amount of hops between the destination and source e.g. a trans-continental connection rather than a simple dorm room LAN.

The advantage with UDP though compared to TCP is very little packet overhead. UDP itself uses 8 bytes and TCP uses more. Now I am able to encapsulate the original game data in a specialized packet so that anyone that does "spamming" won't affect game play maybe with exception of game speed on local machine. Also, many games use UDP for the same reason: Speed.

But what I can do is maybe measure connection speeds one way or another or require users to specify their current country then they can connect with people nearby to reduce the overall game lag.

Reply 18 of 27, by BloodyCactus

User metadata
Rank Oldbie
Rank
Oldbie
mike_canada wrote on 2021-08-14, 01:36:

The advantage with UDP though compared to TCP is very little packet overhead. UDP itself uses 8 bytes and TCP uses more. Now I am able to encapsulate the original game data in a specialized packet so that anyone that does "spamming" won't affect game play maybe with exception of game speed on local machine. Also, many games use UDP for the same reason: Speed.

is speed even relevant tho? we have 1, 2.5, 5gb ethernet now. your encapsulating an ipx packet system designed for dos games on 10mbit on home lans running bnc with t connectors and loads of packet collision.

I dont think it matters about speed of udp over tcp anymore knowing what the target was designed for.

--/\-[ Stu : Bloody Cactus :: [ https://bloodycactus.com :: http://kråketær.com ]-/\--

Reply 19 of 27, by mike_canada

User metadata
Rank Member
Rank
Member
BloodyCactus wrote on 2021-08-14, 02:05:
mike_canada wrote on 2021-08-14, 01:36:

The advantage with UDP though compared to TCP is very little packet overhead. UDP itself uses 8 bytes and TCP uses more. Now I am able to encapsulate the original game data in a specialized packet so that anyone that does "spamming" won't affect game play maybe with exception of game speed on local machine. Also, many games use UDP for the same reason: Speed.

is speed even relevant tho? we have 1, 2.5, 5gb ethernet now. your encapsulating an ipx packet system designed for dos games on 10mbit on home lans running bnc with t connectors and loads of packet collision.

I dont think it matters about speed of udp over tcp anymore knowing what the target was designed for.

But with TCP/IP, it involves connecting to the server then downloading the correct data all in order or redownloading all missed segments. My internet is not slow either but when it comes to dos emulation, the speed can be limited by the host processing power and by whatever speed is allowed by the host and probably other factors because its unlikely anyone will run MS-DOS only with a high-speed network (well maybe except for the mTCP author)