Skip to content

Instantly share code, notes, and snippets.

@Lewuathe
Created February 4, 2013 13:05
Show Gist options
  • Select an option

  • Save Lewuathe/4706638 to your computer and use it in GitHub Desktop.

Select an option

Save Lewuathe/4706638 to your computer and use it in GitHub Desktop.
net.socket()の再利用 ref: http://qiita.com/items/7f3b7b07a7364123d70a
var net = require('net');
var socket = new net.Socket();
socket.on('close',function(){
console.log('close');
process.nextTick(function(){
socket.connect(80, "www.google.com");
});
});
socket.connect(80, "www.google.com");
socket.destroy();
var net = require('net');
var socket = new net.Socket();
socket.on('close',function(){
console.log('close');
socket.connect(80, "www.google.com");
});
socket.connect(80, "www.google.com");
socket.destroy();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment