1.0.1 • Published 10 years ago

net-connect v1.0.1

Weekly downloads
4
License
MIT
Repository
github
Last release
10 years ago

Build Status

net-connect

Make tcp connections with a convenient api.

Example

var connect = require('net-connect');

// port
var con = connect(1337);

// ":port"
var con = connect(':1337');

// "host:port"
var con = connect('1.2.3.4:1337');

// { host, port }
var con = connect({ host: '1.2.3.4', port: 1337 });

// { address, port }
// this is what you get from server.address()
var con = connect({ address: '1.2.3.4', port: 1337 });

Installation

$ npm install net-connect

API

connect(obj, listener)

Create a tcp connection to the address specified by obj.

Optionally pass a listener fn to be called when the connection has been established.

connect.parse(obj)

Parse obj and return a { host, port } object. This is used internally by connect().

License

MIT

1.0.1

10 years ago

1.0.0

10 years ago