19 lines
363 B
JavaScript
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;
|
|
};
|