@js-util/net-socket-connect

1.0.2 • Public • Published

net-socket-connect

Given the remote port/host, setup a low level, net.Socket. With callbacks and connect timeout!

npm install

npm install --save @js-util/net-socket-connect

Example usage

PS: This is incomplete code, you will need to modify for your actual use case.

// Load the module
const netSocketTimeout = require("@js-util/net-socket-connect);

// Create the server with the socket listening event
let remotesocket = netSocketTimeout(80, "127.0.0.1", (socket, err) => {
	
	if( err ) {
		console.error(err);
		return;
	}

	doSomethingWithSocket(socket);

}, 5000 /* connect timeout in ms */ );

Package Sidebar

Install

npm i @js-util/net-socket-connect

Weekly Downloads

4

Version

1.0.2

License

MIT

Unpacked Size

4.66 kB

Total Files

4

Last publish

Collaborators

  • picocreator