Created
February 4, 2013 13:05
-
-
Save Lewuathe/4706638 to your computer and use it in GitHub Desktop.
net.socket()の再利用 ref: http://qiita.com/items/7f3b7b07a7364123d70a
This file contains hidden or 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
| 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(); |
This file contains hidden or 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
| 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