How to use the net.connect function in net

To help you get started, we’ve selected a few net examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wuchangming / node-mitmproxy / src / mitmproxy / createConnectHandler.js View on Github external
function connect (req, cltSocket, head, hostname, port) {
    // tunneling https
    var proxySocket = net.connect(port, hostname, () => {
        cltSocket.write('HTTP/1.1 200 Connection Established\r\n' +
        'Proxy-agent: node-mitmproxy\r\n' +
        '\r\n');
        proxySocket.write(head);
        proxySocket.pipe(cltSocket);
        cltSocket.pipe(proxySocket);
    });
    proxySocket.on('error', (e) => {
        console.log(colors.red(e));
    });
    return proxySocket;
}
github avwo / whistle / lib / index.js View on Github external
resolveHost(url || tunnelUrl, function(ip) {
				resSocket = net.connect(options.port, ip, function() {
		            resSocket.pipe(reqSocket).pipe(resSocket);
		            sendEstablished();
		        });
				abortIfUnavailable(resSocket);
			}, ip);
		}
github ypetya / stompbroker / stomp / js / chat / stomp.chat.lib.js View on Github external
constructor(props) {
        this.conn = net.connect(props.port || 3490, props.host || 'localhost');
        this.noEcho = props.noEcho;
        this.conn.setNoDelay(true);
        this.conn.once('ready', this.connect.bind(this));
    }
github vibedrive / vibedrive / packages / terminal / index.js View on Github external
function connect () {
  socket = net.connect({ port: PORT }, onConnect)

  socket.on('error', retry)
  socket.on('end', onEnd)
}

net

Globalizes the 'net' module functions

MIT
Latest version published 11 years ago

Package Health Score

50 / 100
Full package analysis