IP networking under FreeDOS #1175
Replies: 7 comments 50 replies
-
Wow, cool!
It's a mTCP 2024-10-20? After some tests, I found that the DOSLynx' network stack works well, you can try it at https://copy.sh/v86?profile=msdos, run |
Beta Was this translation helpful? Give feedback.
-
I think I found the reason why HTGET.EXE (mTCP's HTTP GET command line client) in mTCP hangs at the end! To clarify, HTGET.EXE does not crash, it prints nicely to stdout while data is coming in but then sits there waiting for what appears to be the last chunk of data. HTGET.EXE responds to user input and can be exited normally. After some digging I came to the conclusion that TCP's graceful close handshake in fake network is incomplete. The required TCP state values are defined but hardly used, some details of the TCP state machine are missing. Then I found this FIN-related bug in TCPConnection.pump(): the second When I changed the second
it made HTGET.EXE work! Everything else using TCP broke though (which makes sense, with this hack any TCP connection is getting the FIN bit set as soon as it runs out of data to send), but this is a significant clue as to where the hanging connections in HTGET.EXE come from. I will try to properly complete the TCP state-related code in fake_network.js. I'm aiming at full support for all mTCP binaries under FreeDOS. mTCP's FTP server and their new NetDrive look really interesting. WispServerCpp works great, I run it inside a Debian VM on my Windows Desktop (VirtualBox) which gives me a local high-speed WISP server. I've installed a whole Debian 12 into V86 with network support using WISP, including |
Beta Was this translation helpful? Give feedback.
-
The problem with HTGET.EXE is fixed! When I run The response content gets forwarded chunk by chunk (1460 bytes each) from RAM to the application running under the guest OS by TCPConnection.pump(). The misbalance in bandwidth between the two sides is very important to understand what is going on here. Directly after the last call to TCPConnection.write() (when the WISP download is complete) TCPConnection.close() gets called, potentially (long) before the buffered response content has been forwarded to the guest. Closing the TCP connection by setting the FIN flag when we still have buffered data to send must be delayed until the send buffer is empty, only the last buffered package we forward to the guest must have its FIN flag set (that's how this flag is defined). That turned out to be very easy to fix, mTCP's HTGET.EXE now works just fine together with all the other TCP things. |
Beta Was this translation helpful? Give feedback.
-
Here are some network performance statistics that I now feel confident about. Even though they were created using Debian they are also relevant for FreeDOS. Test setup
For reproducible download speed tests I wrote bash script # FD13-LiveCD.zip: 374M
URL="http://10.0.0.44/download/FD13-LiveCD.zip"
curl -L -o /dev/null "$URL" 2>&1 | tr "\r" "\n" It prints nice statistics to stdout and discards downloaded data to the null device. Test results
wisp- and fetch-based networking have about the same performance (both use V86's fake network), whereas websocketproxy-based is quite far behind. A lesson learned: Always prefer network device "virtio" over "ne2k" if you can, ne2k dies midflight under sustained load. EDIT: replaced WISP server WispServerCpp with wisp-js, updated WISP results. EDIT 2: @SuperMaxusa replied to this with his excellent fetch benchmark results Footnotes
|
Beta Was this translation helpful? Give feedback.
-
More benchmarks, comparing wsproxy, wisp and fetch (rows) under buildroot and debian (columns): EDIT: Benchmarks are fully automated, see here for the HTML source file. If you want to use it you'll need to edit the URL of libv86.js at the top, and the entire "Local configuration" section. |
Beta Was this translation helpful? Give feedback.
-
I finally figured out how to properly run Chrome in my local test setup. Tested with Chrome 131.0.6778.86 (Windows/MSYS2):
The reason I need all that is because I test against a local Apache2 server with a cheap, self-signed SSL certificate. For some reason Chrome fails to load the Debian image (probably too large at 2047MB), and the WISP test breaks down in the middle, that's all work in progress, however here the first results: Things to note:
One last note: In general, the behaviour of websockproxy is a bit strange. In my previous benchmarks, websockproxy is noticably slower under buildroot than under Debian, whereas in fetch and WISP it's the opposite. And it seems to underperform. |
Beta Was this translation helpful? Give feedback.
-
I spent the last couple of evenings attempting to reimplement websockproxy, it's called It is the fastest network backend I've measured so far, and since it operates on OSI layer 2 (full ethernet packets) it is practically universal. I'm setting up the TAP device on the linux host exactly like @benjamincburns, I believe his setup is conceptually hard to beat, but I'm no TAP expert, though I plan to read up on this subject. The proxy is also written in Python, but in python 3 and I'm only using the sans-io WebSocket protocol implementation from the websockets library as an external dependency. Internally I run a single epoll loop on all sockets and the TAP device. The python proxy server does not support TLS (wss), for that I use Apache2 as a frontend (it handles the SSL and proxies the websocket connection to my server). Note that the results from above go through Apache2 (relay URL It is still in a very early stage, I will release it as soon as it is presentable. |
Beta Was this translation helpful? Give feedback.
-
I have a FreeDOS image with V86 network support using mTCP. mTCP is under active development and comes shipped with FreeDOS.
Both UDP and TCP are working, so far I've tested DHCP and DNS packets as well as raw TCP streams. For TCP I've used a simple
nc
(netcat) which is part of mTCP. I'm using DHCP for auto-IP setup when FreeDOS boots, it works out of the box.Is anyone interested in this or is this nothing new and networking under FreeDOS has already been done before?
My local V86 network relay is WispServerCpp.
Currently I'm using a RTL8029AS network driver I found on the internet, not sure if that is neccessary (I'll try to switch to one of the drivers that comes with FreeDOS). Is there a recommended DOS packet driver for V86?EDIT: The generic NE2000 driver that is distributed with FreeDOS works, too (given the right arguments:C:\NET\FDNET\NE2000.COM 0x60 0xA 0x300
).Getting this to work involves a patch to src/browser/fake_network.js (add UDP checksum in write_udp()).
Here's the response for a HTTP GET-Request to http://www.osdever.net/FreeVGA/home.htm using
nc
:freedos-nc-osdever_net.webm
The HTTP Request is not echoed here, so you directly see the response after connect and a short pause, the "Bad Request" at the end is me pressing Ctrl+D.
Beta Was this translation helpful? Give feedback.
All reactions