Dan Newcome on technology

I'm bringing cyber back

Node.net – Node.js implemented in Javascript on the .NET runtime

with 42 comments

– Update:

This has gotten more attention after I posted this and I haven’t gotten around to doing another post. I started working on a v8 port of this after the initial JScript version just to see if it was feasible after I got some comments suggesting using v8 instead of JScript. There is currently a really rough version of the Tcp server done using v8 under v8\ along with my other hackings trying to figure out v8 embedding. I pushed the code up as soon as I had something working the other day, and c++ isn’t my first language so it is pretty rough. However I solved many of the tricky bits such as storing managed handles so that they can be accessed later from js.

I’ve been using Node.js recently and I’m loving it. I’ve dabbled in server-side Javascript on and off over the last two years or so with Rhino and later with writing my own hack servers using JScript on the .NET framework, and Node is hands-down the best way to run Javascript on the server to come along so far.

I got the idea last weekend that it should be possible to use the Microsoft JScript language to implement an event-driven server in .NET similar to Node.js. Before anyone gets too uppity about Node.net not being a full implementation of Node.js, let me say that this was a weekend hack that ended up working out, so I extended it just enough so that it should make sense to someone who is familiar with Node.js.


  • Same theory of operation as Node.js (single threaded eventing front-end, non-blocking IO back-end)
  • API compatibility with Node.js
  • Written entirely in Javascript (JScript.NET)
  • Runs on the .NET runtime

What is implemented

  • Enough of the `http’ module to implement a basic server that handles post data and sends back response
  • Enough of the `net’ module to implement a TCP server that echoes requests to stdout
  • Enough of the `stream’ api to support the above
  • require()
  • sys.puts()


  • HTTP requests are cached by .NET even though the stream is read async. This was a limitation of using HttpListener in .NET. The TCP server is fully streaming however.
  • Writes are implemented as blocking calls currently. I didn’t have time to implement write queues to enforce write ordering.


A binary distribution is available here. Grab the source from here.


On Windows:

If you have the .NET 2.0 framework installed (likely if you are on a Windows box), just run the build script. If you’d rather build against a different framework version, you can alter the path to jsc.exe.

C:\> node.exe server.js

On Linux, under Mono:

C:\> mono node.exe server.js

In order to run under Mono, you’ll need Microsoft’s version of Microsoft.JScript.dll, which is included in the .NET framework. I can’t provide it here since it is not redistributable individually.


Running an HTTP server that prints post data to the console and replies with an `All finished’ message when the request completes:

var sys = require( 'sys' ), http = require( 'http' );
http.createServer( function( request, response ) {
	request.addListener( 'data', function( data ) {
		sys.puts( data );
	request.addListener( 'end', function() {
		response.write( '<html><body><p>All finished!<p></body></html>' );
}).listen( 9981, 'localhost' );

To test it out, try something like this:

C:\>curl http://localhost:9981 -d "hello"
<html><body><p>All finished!<p></body></html>

Running a TCP server that listens on port 9982 and writes data sent to the console:

var sys = require( 'sys' ), net = require( 'net' );
net.createServer( function( stream ) {
	stream.addListener( 'data', function( data ) {
		sys.puts( data );
}).listen( 9982, 'localhost' );

To test out the TCP server try sending it some data using telnet:

C:\>telnet localhost 9982

Although I’m aiming to expose everything as an API that is compatible with Node.js, you can access the .NET framework from within the Javascript that runs under Node.net.
For example, the TCP server shown above could have used Console.WriteLine() in order to write its output to the console:

var net = require( 'net' );
net.createServer( function( stream ) {
	stream.addListener( 'data', function( data ) {
		System.Console.WriteLine( data );
}).listen( 9982, 'localhost' );

The preceding samples are exactly the same as the code you would have written to accomplish the tasks in Node.js (with the exception of Console.WriteLine() of course ).

Building from source

Get the source from github here.

On Windows:

C:\> build.bat

On Linux

Mono’s mjs compiler doesn’t compile Node.net. Let me know if you get it to work.

Future work

Non-blocking writes is the biggest unimplemented piece of the architecture. After having gotten the locking semantics figured out for the main dispatch loop to avoid races (I think it is correct — if you are a threading guru I invite you to double-check my work), I didn’t feel like tackling writes. The current HTTP implementation isn’t streaming, and should be rewritten to use the `net’ module instead. This would entail writing an HTTP parser, which I wasn’t prepared to spend time doing. Also, most of the Node.js API remains unimplemented. I haven’t looked at the source code for Node.js much, but I’m wondering if some of its Javascript code could  be ported to work with Node.net.


Written by newcome

May 8, 2010 at 8:34 am

Posted in Uncategorized

42 Responses

Subscribe to comments with RSS.

  1. […] Link: Node.net – Node.js implemented in Javascript on the .NET runtime … […]

  2. Neat! What about actually using V8 for this?


    May 14, 2010 at 9:10 am

  3. Could you please provide a builded version?

    Fedor Indutny

    May 23, 2010 at 10:29 pm

  4. @Fedor Indutny – there’s a link to a binary version in the post:


    Brian McKenna

    May 23, 2010 at 11:59 pm

  5. AFAIK JScript.NET is deprecated,did you try it with http://github.com/fholm/IronJS dlr implementation?

    Best wishes.

    Andrey Skvortsov

    May 24, 2010 at 10:14 am

  6. thanks for ur script 🙂


    June 30, 2010 at 12:42 am

  7. Interesting work,I like JScript.Net, too, but what about Managed JScript?


    September 15, 2010 at 6:59 pm

  8. @frank Thanks! — Actually JScript.NET is the same thing as what you are referring to as Managed JScript I believe. If you look at the JScript version of Node.net (there are now 3 different implementations — IronJS, V8, and JScript) it is fully compiled to a .NET assembly using the JScript .NET compiler (jsc.exe). At least I think that is what you meant.


    September 15, 2010 at 11:48 pm

  9. You can also try to use Jint JS engine, i had used it successfully in a number of my projects.

    Alexander Nikitin

    December 8, 2010 at 8:55 am

  10. You can also look at this project as it seems to be fairly active:


    Also, have you thought about getting this hosted on codeplex or github (the github link in your post is broken) so that you can get some help with this!? This would be a great tool to help with SSJS!!! Great work!


    January 13, 2011 at 5:06 pm

  11. @bbqchickenrobot Thanks for checking this out. The github link worked for me, but the link again is https://github.com/dnewcome/Node.net There is a version there where I’m using V8 which looks similar to what they are doing with javascriptdotnet. I started to move away from that toward using IronJS though. Thanks for the pointer to javascriptdotnet.


    January 13, 2011 at 5:41 pm

  12. […] with Mono …Cannot add comment at this time.   Maga D Zandaqo, Web Developer https://newcome.wordpress.com/201https://github.com/dnewcome/Node…Important! Node.js is developed very fast and changed much since […]

  13. Hello! nice blog!


    January 23, 2011 at 9:14 am

  14. […] the past year or so I have been working on-and-off on a project called Node.NET in which I have experimented with embedding several different Javascript implementations within the […]

  15. Great achievement! I’m looking forward to seeing how this project evolves…


    April 13, 2011 at 1:10 am

  16. hslee

    May 25, 2011 at 8:49 pm

  17. peace sign tattoo pictures,


    July 4, 2011 at 5:07 am

  18. I found this interesting because I have been playing with NodeJS on Windows and I ran into some behaviour which I just do not care for in the fs.Watch (directory watch) code. Node throws a whole bunch of extraneous “events” within fs.Watch. E.g., a simple file-save (update) throws two change events even if the file is tiny, whereas using DotNet FileSystemWatcher will limit to one event (on small files). I was just seeing what you had going here if it could be useful to me.

    Houston SQL Server Developer

    December 13, 2011 at 12:04 pm

  19. @houston –
    I never got around to implementing very much of the API, fs.* included. It’s something I’ll look into if/when I get back into this project again. Thanks for pointing this out.


    December 13, 2011 at 3:26 pm

  20. Brilliant idea and implementation! Nice work!


    December 21, 2011 at 8:10 pm

  21. Hello! bddggkd interesting bddggkd site!


    February 16, 2012 at 9:11 am

  22. Hi mates, its great article concerning tutoringand entirely explained, keep it
    up all the time.

    bag n save coupons

    June 6, 2013 at 8:40 pm

  23. It should be fun to buy a new car! Driving a new car is such a great experience,
    and purchasing the car should be fun as well. A lot of
    people would rather skip the whole purchasing process.
    Keep the stress to a minimum using these tips.


    June 20, 2013 at 3:33 am

  24. Hey, I think your blog might be having browser compatibility issues.

    When I look at your blog in Chrome, it looks fine but when
    opening in Internet Explorer, it has some overlapping.
    I just wanted to give you a quick heads up! Other then that, superb blog!


    June 26, 2013 at 5:07 pm

  25. Good day! I know this is kinda off topic however I’d figured
    I’d ask. Would you be interested in exchanging links or maybe guest writing a blog article or vice-versa?

    My site covers a lot of the same topics as yours and I think we could greatly benefit from each other.

    If you might be interested feel free to send me an e-mail.
    I look forward to hearing from you! Superb blog by the way!


    October 25, 2013 at 8:39 am

  26. An intriguing discussion is worth comment. I think that you ought to write more on
    this issue, it might not be a taboo subject but generally people don’t
    speak about such topics. To the next! All the best!!


    October 26, 2013 at 8:44 am

  27. […] building something that embeds V8 into PD in the future. Or maybe even… gasp… the .NET framework. The choice between Lua and Python came down to the ease with which the language embedding was […]

  28. This is really interesting, You are an overly
    professional blogger. I have joined your rss feed and sit up for seeking more of your excellent
    post. Additionally, I have shared your site in my social networks

    flash game review

    May 27, 2014 at 6:51 pm

  29. This is really interesting, You’re a very skilled blogger.
    I have joined your feed and look forward to seeking more
    of your fantastic post. Also, I have shared your site in my social

    wholesale jewelry

    June 8, 2014 at 4:22 am

  30. It’s really a great and helpful piece of information. I am glad that you shared this
    helpful info with us. Please stay us up to date like this.
    Thank you for sharing.

    reviews about chhota bheem

    August 12, 2014 at 7:42 pm

  31. I myself have already been making regular cash online as an affiliate
    for several years.

  32. It’s remarkable designed for me to have a website, which is valuable
    in favor of my experience. thanks admin

  33. Hi, all is going well here and ofcourse every one
    is sharing facts, that’s actually fine, keep up writing.

    seo tools vps

    September 20, 2014 at 5:04 pm

  34. I don’t know whether it’s just me or if perhaps everyone else experiencing problems with your website.

    It appears as if some of the written text in your content are running
    off the screen. Can someone else please comment and let me know if this is happening to them too?
    This could be a problem with my web browser because I’ve
    had this happen before. Cheers

    billig forbrukslån

    September 23, 2014 at 9:13 am

  35. Every weekend i used to visit this site, as i wish for enjoyment, since this this web page conations truly fastidious funny stuff too.

    perfect diets

    October 2, 2014 at 8:30 pm

  36. You shall need to learn your market when putting affiliate internet marketing material on your web

  37. This article is really a good one it helps new internet viewers, who are wishing in favor of blogging.
    more from:http://www.afllc.biz/


    October 7, 2014 at 6:26 am

  38. Fantastic site you have here but I was curious if you knew of any user discussion forums that cover the same topics discussed here?
    I’d really love to be a part of community where I can get opinions
    from other experienced people that share the same interest.
    If you have any suggestions, please let me know. Thanks!

  39. I have read so many posts concerning the blogger lovers except this article is actually a good piece of writing,
    keep it up.

    rampage site

    November 11, 2014 at 3:04 pm

  40. Various meanings of those codes is available from the board manufacturer or often times within the documentation added with
    a system. If a specific piece of data may be requested five times before, its potential that this specific
    bit of data will probably be required again and for that reason is stored inside the cache memory.
    Toshiba has a excellent laptop line-up because of their higher priced models as well.


    March 4, 2015 at 6:13 pm

  41. Hi. I have been working on the task of porting node js to Win CE 6 environment which runs on .NET 3.5 framwork. Will this Node.NET work on Win CE devices? The binary you built and shared is built for .NET 4.0 I think.

    Can you please tell me whether I could use this Node.NET on my Win CE embedded device. Also can you share the C# solution files for http_parser and IronJS so that I can build it for .NET 3.5?


    Shaik Syed Ali

    October 7, 2016 at 3:52 am

  42. Just want to say your article is as surprising. The clearness in your post
    is just great and i can assume you are an expert on this subject.
    Fine with your permission allow me to grab your feed to keep updated with forthcoming post.
    Thanks a million and please carry on the gratifying work.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: