2016-01-10 20:03:05 +11:00
|
|
|
'use strict';
|
|
|
|
|
2016-01-10 18:23:40 +11:00
|
|
|
const ipc=require('../../../node-ipc');
|
|
|
|
const process=require('process');
|
2016-01-10 18:28:00 +11:00
|
|
|
const dieAfter=30000;
|
2015-12-05 13:40:38 +11:00
|
|
|
|
2016-01-10 18:23:40 +11:00
|
|
|
//die after 60 seconds
|
|
|
|
setTimeout(
|
|
|
|
function killServerProcess(){
|
|
|
|
process.exit(0);
|
|
|
|
},
|
|
|
|
dieAfter
|
|
|
|
);
|
2015-12-05 13:40:38 +11:00
|
|
|
|
2016-01-10 18:23:40 +11:00
|
|
|
ipc.config.id = 'udp6Server';
|
2015-12-05 13:40:38 +11:00
|
|
|
ipc.config.retry= 1500;
|
2016-01-10 18:23:40 +11:00
|
|
|
ipc.config.silent=true;
|
|
|
|
ipc.config.networkPort=8099;
|
2015-12-05 13:40:38 +11:00
|
|
|
|
|
|
|
ipc.serveNet(
|
2016-01-08 10:55:06 +11:00
|
|
|
'::1',
|
2015-12-05 13:40:38 +11:00
|
|
|
'udp6',
|
2016-01-10 18:23:40 +11:00
|
|
|
function serverStarted(){
|
2015-12-05 13:40:38 +11:00
|
|
|
ipc.server.on(
|
|
|
|
'message',
|
2016-01-10 18:23:40 +11:00
|
|
|
function gotMessage(data,socket){
|
2015-12-05 13:40:38 +11:00
|
|
|
ipc.server.emit(
|
|
|
|
socket,
|
|
|
|
'message',
|
|
|
|
{
|
|
|
|
id : ipc.config.id,
|
2016-01-08 10:55:06 +11:00
|
|
|
message : 'I am UDP6 server!'
|
2015-12-05 13:40:38 +11:00
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
ipc.server.start();
|