吕君喜 406d880ac6 first | 3 år sedan | |
---|---|---|
.. | ||
node_modules | 3 år sedan | |
.npmignore | 3 år sedan | |
Readme.md | 3 år sedan | |
index.js | 3 år sedan | |
package.json | 3 år sedan |
net.Socket that automatically reconnects if a server goes down. Maintains 100% compatibility with net.Socket.
$ npm install net-socket --save
For detailed usage, see Node.js documentation on net.Socket - https://nodejs.org/api/net.html#net_class_net_socket.
Quick example:
var net = require('net-socket');
var socket = net.connect(7777, 'localhost');
socket.setEncoding('utf8');
socket.on('connect', function () {
// connected
socket.end('hey');
socket.destroy();
});
WARNING: To prevent socket from reconnecting, use .destroy()
method to completely close it.
$ npm test
WTFPL – Do What the Fuck You Want to Public License