Created
November 7, 2019 10:30
-
-
Save pps83/90c81bf9de20765211fad8bbd9269009 to your computer and use it in GitHub Desktop.
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
// check TCP connect to port/host | |
var sock = require('net').connect({ port: 443, host: '127.0.0.1' }).on('connect', () => { console.log('connect OK'); sock.end(); }).on('error', (e) => { console.log('connect error (code:'+e.code+')'); }) | |
// listen for TCP connect on port/host | |
var server = require('net').createServer((sock) => { console.log('client connected'); sock.end(); }).listen({ port: 443, host: '127.0.0.1' }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment