Skip to content

flow-io/flow-tcp-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TCP Server

NPM version Build Status Coverage Status Dependencies

Thin wrapper for creating TCP servers.

Installation

$ npm install flow-tcp-server

Usage

To use the module,

var createServer = require( 'flow-tcp-server' );

The module exports a single method for creating TCP servers.

createServer( [options,] clbk )

To create a server,

var options = {
	'host': '127.0.0.1',
	'port': 1337	
};

var server = createServer( options, onReady );

function onReady() {
	var addr = server.address();
	console.log( '...server is listening at %s on port %d...', addr.address, addr.port );
}

The options argument is not required. The default host is 127.0.0.1, and the default port is one which is assigned by the system.

The callback is invoked once the server is ready to accept TCP socket connections.

Examples

To run the example code from the top-level application directory,

$ node ./examples/index.js

Tests

Unit

Unit tests use the Mocha test framework with Chai assertions. To run the tests, execute the following command in the top-level application directory:

$ make test

All new feature development should have corresponding unit tests to validate correct functionality.

Test Coverage

This repository uses Istanbul as its code coverage tool. To generate a test coverage report, execute the following command in the top-level application directory:

$ make test-cov

Istanbul creates a ./reports/coverage directory. To access an HTML version of the report,

$ open reports/coverage/lcov-report/index.html

License

MIT license.


Copyright

Copyright © 2014. Athan Reines.

About

Thin wrapper for creating TCP servers.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published