-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
27 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Load the net module to create a tcp server. | ||
var net = require('net'); | ||
|
||
// Creates a new TCP server. The handler argument is automatically set as a listener for the 'connection' event | ||
var server = net.createServer(function (socket) { | ||
|
||
// Every time someone connects, tell them hello and then close the connection. | ||
console.log("Connection from " + socket.remoteAddress); | ||
socket.end("Hello World\n"); | ||
|
||
}); | ||
|
||
// Fire up the server bound to port 7000 on localhost | ||
server.listen(7000, "localhost"); | ||
|
||
// Put a friendly message on the terminal | ||
console.log("TCP server listening on port 7000 at localhost."); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.