Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
const net = require('net');
var r = net.getaddrinfo('localhost', '', {family: net.AF_INET,
type: net.SOCK_STREAM})
var ip = r[0];
var sock = new net.Socket(net.AF_INET, net.SOCK_STREAM);
sock.connect({host: ip, port: 1234});
var data = sock.recv();
print('Received data: ' + data);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment