TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

TCP HTTP Server written in Assembly

154 pointsby thikonomover 11 years ago

13 comments

derefrover 11 years ago
Cool stuff. Really, though, this is still relying on a rather large runtime library: the physical, data-link, and network-layer drivers.<p>Now what&#x27;d be really awesome to see, would be one of those Operating System guides that shows you how to write an OS kernel, in assembler, that can speak HTTP. Even just limiting yourself to targeting the synthetic hardware of a VM program, it&#x27;d still be quite a feat.<p>Bonus points if the entire network stack has been flattened using the hand-rolled equivalent of stream-fusion. :)
评论 #6908505 未加载
评论 #6909879 未加载
评论 #6910486 未加载
评论 #6908315 未加载
neverm0reover 11 years ago
Here&#x27;s another simpler implementation of an HTTP server in Linux x86 assembly from last year, coincidentally by the one who did the Seiken Densetsu 3&#x2F;Secret of Mana 3 translation hack and the old Starscream 68k emulator:<p><a href="http://www.neillcorlett.com/etc/mohttpd.asm.txt" rel="nofollow">http:&#x2F;&#x2F;www.neillcorlett.com&#x2F;etc&#x2F;mohttpd.asm.txt</a><p>And a not so successful thread to go with it: <a href="https://news.ycombinator.com/item?id=4714971" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=4714971</a>
评论 #6909893 未加载
kragenover 11 years ago
I hacked on httpdito some more, and it has been improved in several ways:<p>- it now forks so that it can handle multiple concurrent connections (up to a limit of 2048);<p>- it no longer uses libc at all, so it&#x27;s down to 2088 bytes (I had it lower, but then I added forking);<p>- it&#x27;s less complex now that it only has one way of invoking system calls instead of two;<p>- there are some performance results in the comments.<p>- it has a name, &quot;httpdito&quot;;<p>- strlen works correctly.<p>Probably nobody will read this comment here, but I thought it was worth mentioning.
评论 #6955842 未加载
zw123456over 11 years ago
Very cool I think. But cooler, Web Server on a FPGA, without CPU, only VHDL <a href="http://www.youtube.com/watch?v=7syu5EC1OWg" rel="nofollow">http:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=7syu5EC1OWg</a>
mappuover 11 years ago
Cool!<p>My comments as an inexperienced assembly developer, assuming this is optimising for binary size:<p>- The pug&#x2F;doN macros do an extra reg-reg copy if passed a register - and the recursive definition calls pop&#x2F;pop&#x2F;pop instead of just add %esp, -4*N, you could shave a few bytes<p>- AT&amp;T syntax will always look weird to me, but the heavy use of macros and local labels is quite elegant<p>- A little bit of candid swearing in the comments? Fine by me, but is this officially associated with canonical?
评论 #6908178 未加载
评论 #6908503 未加载
评论 #6909446 未加载
tokenizerover 11 years ago
As a web developer who isn&#x27;t familiar with assembly or any web server more barebones than nginx, what benefits does something like this provide? Speed? Could this be a solution for an extremely simple directory&#x2F;static file web server?
评论 #6908149 未加载
评论 #6908494 未加载
评论 #6909897 未加载
评论 #6908128 未加载
pmiller2over 11 years ago
Neat little piece of performance art (pun intended).
评论 #6908296 未加载
评论 #6909881 未加载
radikalusover 11 years ago
No full tcp stack in assembly? =p<p>(Yes there&#x27;s no point as it&#x27;s better in hardware blah blah)
Vektorwegover 11 years ago
I&#x27;m really happy that executable size doesn&#x27;t matter for server software. Because Yesod produce really big execs.
mikkomover 11 years ago
&gt; Depends on the C libraries.<p>^ That tells everything you need to know.
pekkover 11 years ago
and I just got finished rewriting all my large webapps in some obscure Java framework for performance, because of some benchmarks I saw on HN. Guess now I have to rewrite it all in assembly, because more performance is always better right?
评论 #6908228 未加载
评论 #6908213 未加载
meshkoover 11 years ago
OMG all these macros. It looks more like Python then Assembly. Come on, real men do not use macros.
评论 #6908452 未加载
评论 #6909922 未加载
评论 #6910088 未加载
评论 #6909459 未加载
puppetmaster3over 11 years ago
Likely does not have any back door. Rumor is GCC opens back door for you know who.
评论 #6908320 未加载
评论 #6908414 未加载