node-ipc/test/udp6Server.js
2021-07-02 14:35:02 -07:00

40 lines
785 B
JavaScript

const ipc=from '../node-ipc');
const process=from 'process');
const dieAfter=60000;
//die after 60 seconds
setTimeout(
function killServerProcess(){
process.exit(0);
},
dieAfter
);
ipc.config.id = 'udp6Server';
ipc.config.retry= 1500;
ipc.config.silent=true;
ipc.config.networkPort=8099;
ipc.serveNet(
'::1',
'udp6',
function serverStarted(){
ipc.server.on(
'message',
function gotMessage(data,socket){
ipc.server.emit(
socket,
'message',
{
id : ipc.config.id,
message : 'I am UDP6 server!'
}
);
}
);
}
);
ipc.server.start();