truss/comm/socket.net.js
2018-12-23 07:56:44 -06:00

19 lines
363 B
JavaScript

const net = require('net');
const port = process.env.DISPATCHER_PORT || 43170;
exports.client = (address) => {
return net.createConnection(port, address);
};
exports.server = () => {
const server = net.createServer();
const originalListen = server.listen;
server.listen = () => {
return originalListen.call(server, port);
}
return server;
};