Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
| Installing Node.js on Windows, Mac |
Thanks to Ryan Dahl’s presentations and materials, I have been able to follow along and learn a little about Node.js. I hope to show you what I learn as I learn it. The first step is get the latest version of Node installed.
![]() |
| Using Node.js interactively |
Bring up a command prompt. Bring up a command prompt. Type in node start the interpreter. Define a function. You can ignore the “undefined” message. You can now call the function, passing in “212.” Notice we get “100” as the answer, since 212 Fahrenheit is 100 Celsius. |
| Write Node.js scripts and running them |
You can request the process id very simply. setTimeout.js
![]() |
| A simple HTTP Server – Demo |
The code below creates a very basic web server. The code below does the following:
Here is the output. Notice that on the left we execute simpleServer.js. On the right side we execute the code in simpleServer.js by navigating a browser to https://127.0.0.1:8000. Note the 8000, because that is the port we are listening on. Inspecting http headers with Fiddler Fiddler is an HTTP debugging proxy server application. It captures HTTP traffic and logs it for the user to review. Here is what to notice about the call we just made.
|
| A Node.js TCP Server |
We just demonstrated http. The next section is learning about TCP. TCP is considered a very lightweight protocol, free of the overhead of http. Notice in the code below we require ‘net,’ not ‘http.’ Everything else should look somewhat familiar from before. But let’s be clear. TCP is a transport layer protocol and HTTP is an application layer protocol. HTTP (usually) operates over TCP, so whichever option you choose, it will still be operating over TCP. TCP sockets are more bandwidth efficient, since HTTP contains a whole bunch of extra data (the headers) that would likely not be needed. HTTP is not particularly suited to n-way chat servers. tcpServer.js
![]() |
Download for Azure SDK |
Comments
Anonymous
February 23, 2012
Nice article. My team currently port recent .NET(Service/WCF Restful) apps to node.js which is boost significant performance compared with previous service wrote on C# but client side still asp.net mvc v3. Node.js Rock !!Anonymous
May 21, 2012
really nice, could you post about c# sending to nodejs code pleaseAnonymous
October 01, 2012
Could you also explain sending messages, via C#, to nodejs? Thanks!Anonymous
April 01, 2015
Could you also explain sending messages, via C#, to nodejs? Thanks!Anonymous
April 01, 2015
Could you also explain sending messages, via C#, to nodejs? Thanks!!!!

Type in node start the interpreter.
Define a function. You can ignore the “undefined” message.
You can now call the function, passing in “212.”
Notice we get “100” as the answer, since 212 Fahrenheit is 100 Celsius.
setTimeout.js

The code below does the following:
Here is the output. Notice that on the left we execute simpleServer.js. On the right side we execute the code in simpleServer.js by navigating a browser to
Inspecting http headers with Fiddler Fiddler is an HTTP debugging proxy server application. It captures HTTP traffic and logs it for the user to review. Here is what to notice about the call we just made.
