test server auto shutdown fixes #60

This commit is contained in:
Brandon Nozaki Miller 2016-01-09 23:23:40 -08:00
parent 45cf879345
commit fa59d14ca4
24 changed files with 635 additions and 625 deletions

View file

@ -22,7 +22,8 @@
"jasmine": "^2.4.1"
},
"scripts": {
"test": "istanbul cover -x **/spec/** -dir ./spec/coverage jasmine"
"test": "istanbul cover -x **/spec/** -dir ./spec/coverage jasmine",
"cover": "istanbul cover -x **/spec/** -dir ./spec/coverage jasmine&& cat ./spec/coverage/lcov.info | codacy-coverage"
},
"keywords": [
"IPC",

File diff suppressed because one or more lines are too long

View file

@ -20,14 +20,14 @@
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">66.17% </span>
<span class="strong">65.68% </span>
<span class="quiet">Statements</span>
<span class='fraction'>268/405</span>
<span class='fraction'>266/405</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">55.45% </span>
<span class="strong">54.95% </span>
<span class="quiet">Branches</span>
<span class='fraction'>112/202</span>
<span class='fraction'>111/202</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">74.42% </span>
@ -35,9 +35,9 @@
<span class='fraction'>32/43</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">66.17% </span>
<span class="strong">65.68% </span>
<span class="quiet">Lines</span>
<span class='fraction'>268/405</span>
<span class='fraction'>266/405</span>
</div>
</div>
</div>
@ -73,15 +73,15 @@
<tr>
<td class="file medium" data-value="node-ipc/lib/"><a href="node-ipc/lib/index.html">node-ipc/lib/</a></td>
<td data-value="64.07" class="pic medium"><div class="chart"><div class="cover-fill" style="width: 64%;"></div><div class="cover-empty" style="width:36%;"></div></div></td>
<td data-value="64.07" class="pct medium">64.07%</td>
<td data-value="270" class="abs medium">173/270</td>
<td data-value="52.31" class="pct medium">52.31%</td>
<td data-value="130" class="abs medium">68/130</td>
<td data-value="63.33" class="pic medium"><div class="chart"><div class="cover-fill" style="width: 63%;"></div><div class="cover-empty" style="width:37%;"></div></div></td>
<td data-value="63.33" class="pct medium">63.33%</td>
<td data-value="270" class="abs medium">171/270</td>
<td data-value="51.54" class="pct medium">51.54%</td>
<td data-value="130" class="abs medium">67/130</td>
<td data-value="78.79" class="pct medium">78.79%</td>
<td data-value="33" class="abs medium">26/33</td>
<td data-value="64.07" class="pct medium">64.07%</td>
<td data-value="270" class="abs medium">173/270</td>
<td data-value="63.33" class="pct medium">63.33%</td>
<td data-value="270" class="abs medium">171/270</td>
</tr>
</tbody>
@ -90,7 +90,7 @@
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Jan 08 2016 21:50:31 GMT-0800 (PST)
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Sat Jan 09 2016 23:03:42 GMT-0800 (PST)
</div>
</div>
<script src="prettify.js"></script>

View file

@ -77,7 +77,7 @@
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Jan 08 2016 21:50:31 GMT-0800 (PST)
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Sat Jan 09 2016 23:03:42 GMT-0800 (PST)
</div>
</div>
<script src="../prettify.js"></script>

View file

@ -754,7 +754,7 @@ module.exports=init;
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Jan 08 2016 21:50:31 GMT-0800 (PST)
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Sat Jan 09 2016 23:03:42 GMT-0800 (PST)
</div>
</div>
<script src="../../prettify.js"></script>

View file

@ -85,9 +85,9 @@
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">15×</span>
<span class="cline-any cline-yes">15×</span>
<span class="cline-any cline-yes">15×</span>
<span class="cline-any cline-yes">16×</span>
<span class="cline-any cline-yes">16×</span>
<span class="cline-any cline-yes">16×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
@ -130,7 +130,7 @@ module.exports=parser;
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Jan 08 2016 21:50:31 GMT-0800 (PST)
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Sat Jan 09 2016 23:03:42 GMT-0800 (PST)
</div>
</div>
<script src="../../prettify.js"></script>

View file

@ -20,14 +20,14 @@
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">64.07% </span>
<span class="strong">63.33% </span>
<span class="quiet">Statements</span>
<span class='fraction'>173/270</span>
<span class='fraction'>171/270</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">52.31% </span>
<span class="strong">51.54% </span>
<span class="quiet">Branches</span>
<span class='fraction'>68/130</span>
<span class='fraction'>67/130</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">78.79% </span>
@ -35,9 +35,9 @@
<span class='fraction'>26/33</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">64.07% </span>
<span class="strong">63.33% </span>
<span class="quiet">Lines</span>
<span class='fraction'>173/270</span>
<span class='fraction'>171/270</span>
</div>
</div>
</div>
@ -86,15 +86,15 @@
<tr>
<td class="file medium" data-value="socketServer.js"><a href="socketServer.js.html">socketServer.js</a></td>
<td data-value="55.92" class="pic medium"><div class="chart"><div class="cover-fill" style="width: 55%;"></div><div class="cover-empty" style="width:45%;"></div></div></td>
<td data-value="55.92" class="pct medium">55.92%</td>
<td data-value="152" class="abs medium">85/152</td>
<td data-value="52.38" class="pct medium">52.38%</td>
<td data-value="84" class="abs medium">44/84</td>
<td data-value="54.61" class="pic medium"><div class="chart"><div class="cover-fill" style="width: 54%;"></div><div class="cover-empty" style="width:46%;"></div></div></td>
<td data-value="54.61" class="pct medium">54.61%</td>
<td data-value="152" class="abs medium">83/152</td>
<td data-value="51.19" class="pct medium">51.19%</td>
<td data-value="84" class="abs medium">43/84</td>
<td data-value="65" class="pct medium">65%</td>
<td data-value="20" class="abs medium">13/20</td>
<td data-value="55.92" class="pct medium">55.92%</td>
<td data-value="152" class="abs medium">85/152</td>
<td data-value="54.61" class="pct medium">54.61%</td>
<td data-value="152" class="abs medium">83/152</td>
</tr>
</tbody>
@ -103,7 +103,7 @@
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Jan 08 2016 21:50:31 GMT-0800 (PST)
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Sat Jan 09 2016 23:03:42 GMT-0800 (PST)
</div>
</div>
<script src="../../prettify.js"></script>

View file

@ -20,14 +20,14 @@
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">55.92% </span>
<span class="strong">54.61% </span>
<span class="quiet">Statements</span>
<span class='fraction'>85/152</span>
<span class='fraction'>83/152</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">52.38% </span>
<span class="strong">51.19% </span>
<span class="quiet">Branches</span>
<span class='fraction'>44/84</span>
<span class='fraction'>43/84</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">65% </span>
@ -35,9 +35,9 @@
<span class='fraction'>13/20</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">55.92% </span>
<span class="strong">54.61% </span>
<span class="quiet">Lines</span>
<span class='fraction'>85/152</span>
<span class='fraction'>83/152</span>
</div>
</div>
</div>
@ -550,8 +550,8 @@
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">2×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
@ -617,8 +617,8 @@
<span class="cline-any cline-yes">4×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">3×</span>
<span class="cline-any cline-yes">3×</span>
<span class="cline-any cline-yes">4×</span>
<span class="cline-any cline-yes">4×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
@ -628,30 +628,30 @@
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">3×</span>
<span class="cline-any cline-yes">3×</span>
<span class="cline-any cline-yes">4×</span>
<span class="cline-any cline-yes">4×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">3×</span>
<span class="cline-any cline-yes">4×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">3×</span>
<span class="cline-any cline-yes">4×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">3×</span>
<span class="cline-any cline-yes">4×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">3×</span>
<span class="cline-any cline-yes">4×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">3×</span>
<span class="cline-any cline-yes">3×</span>
<span class="cline-any cline-yes">3×</span>
<span class="cline-any cline-yes">4×</span>
<span class="cline-any cline-yes">4×</span>
<span class="cline-any cline-yes">4×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">3×</span>
<span class="cline-any cline-yes">4×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">3×</span>
<span class="cline-any cline-yes">3×</span>
<span class="cline-any cline-yes">4×</span>
<span class="cline-any cline-yes">4×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">3×</span>
<span class="cline-any cline-yes">4×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
@ -663,17 +663,17 @@
<span class="cline-any cline-yes">4×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">2×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">2×</span>
<span class="cline-any cline-yes">2×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">2×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">2×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">2×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
@ -913,9 +913,9 @@ function init(path,config,log,port){
socket.port,
socket.address,
function(err, bytes) {
if(err){
server.log('error writing data to socket'.warn,err);
server.trigger(
<span class="missing-if-branch" title="if path not taken" >I</span>if(err){
<span class="cstat-no" title="statement not covered" > server.log('error writing data to socket'.warn,err);</span>
<span class="cstat-no" title="statement not covered" > server.trigger(</span>
'error',
<span class="fstat-no" title="function not covered" > function(err){</span>
<span class="cstat-no" title="statement not covered" > server.trigger('error',err);</span>
@ -1141,7 +1141,7 @@ module.exports=init;
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Jan 08 2016 21:50:31 GMT-0800 (PST)
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Sat Jan 09 2016 23:03:42 GMT-0800 (PST)
</div>
</div>
<script src="../../prettify.js"></script>

View file

@ -351,7 +351,15 @@
306
307
308
309</td><td class="line-coverage quiet"><span class="cline-any cline-yes">1×</span>
309
310
311
312
313
314
315
316
317</td><td class="line-coverage quiet"><span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
@ -407,8 +415,9 @@
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">140×</span>
<span class="cline-any cline-yes">69×</span>
<span class="cline-any cline-yes">141×</span>
<span class="cline-any cline-yes">70×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">71×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
@ -416,6 +425,7 @@
<span class="cline-any cline-yes">229×</span>
<span class="cline-any cline-yes">210×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">19×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
@ -428,6 +438,7 @@
<span class="cline-any cline-yes">8×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">8×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">8×</span>
@ -436,6 +447,7 @@
<span class="cline-any cline-yes">8×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">8×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
@ -456,6 +468,7 @@
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
@ -534,6 +547,7 @@
<span class="cline-any cline-yes">3×</span>
<span class="cline-any cline-yes">2×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">3×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
@ -549,6 +563,7 @@
<span class="cline-any cline-yes">4×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">4×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
@ -635,6 +650,7 @@
<span class="cline-any cline-yes">4×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">4×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
@ -715,14 +731,16 @@ var ipc = {
}
&nbsp;
function log(){
if(ipc.config.silent)
if(ipc.config.silent){
return;
}
&nbsp;
var args=Array.prototype.slice.call(arguments);
&nbsp;
for(var i=0, count=args.length; i&lt;count; i++){
if(typeof args[i] != 'object')
if(typeof args[i] != 'object'){
continue;
}
&nbsp;
args[i]=util.inspect(args[i],{colors:true});
}
@ -733,19 +751,21 @@ function log(){
}
&nbsp;
function disconnect(id){
<span class="missing-if-branch" title="if path not taken" >I</span>if(!ipc.of[id])
<span class="missing-if-branch" title="if path not taken" >I</span>if(!ipc.of[id]){
<span class="cstat-no" title="statement not covered" > return;</span>
}
&nbsp;
ipc.of[id].config.stopRetrying=true;
&nbsp;
ipc.of[id].off('*');
<span class="missing-if-branch" title="else path not taken" >E</span>if(ipc.of[id].socket){
<span class="missing-if-branch" title="else path not taken" >E</span>if(ipc.of[id].socket.destroy)
<span class="missing-if-branch" title="else path not taken" >E</span>if(ipc.of[id].socket.destroy){
ipc.of[id].socket.destroy();
}
}
&nbsp;
delete ipc.of[id];
}
};
&nbsp;
function serve(path,callback){
<span class="missing-if-branch" title="else path not taken" >E</span>if(typeof path=='function'){
@ -761,8 +781,9 @@ function serve(path,callback){
path=ipc.config.socketRoot+ipc.config.appspace+ipc.config.id;
}
&nbsp;
<span class="missing-if-branch" title="if path not taken" >I</span>if(!callback)
<span class="missing-if-branch" title="if path not taken" >I</span>if(!callback){
<span class="cstat-no" title="statement not covered" > callback=<span class="fstat-no" title="function not covered" >function(){</span>};</span>
}
&nbsp;
ipc.server=new Server(
path,
@ -828,9 +849,9 @@ function serveNet(host,port,UDPType,callback){
<span class="cstat-no" title="statement not covered" > UDPType=false;</span>
}
&nbsp;
<span class="missing-if-branch" title="if path not taken" >I</span>if(!callback)
<span class="missing-if-branch" title="if path not taken" >I</span>if(!callback){
<span class="cstat-no" title="statement not covered" > callback=<span class="fstat-no" title="function not covered" >function(){</span>};</span>
&nbsp;
}
&nbsp;
ipc.server=new Server(
host,
@ -839,8 +860,9 @@ function serveNet(host,port,UDPType,callback){
port
);
&nbsp;
if(UDPType)
if(UDPType){
ipc.server[UDPType]=true;
}
&nbsp;
ipc.server.on(
'start',
@ -854,8 +876,9 @@ function connect(id,path,callback){
path=false;
}
&nbsp;
<span class="missing-if-branch" title="if path not taken" >I</span>if(!callback)
<span class="missing-if-branch" title="if path not taken" >I</span>if(!callback){
<span class="cstat-no" title="statement not covered" > callback=<span class="fstat-no" title="function not covered" >function(){</span>};</span>
}
&nbsp;
<span class="missing-if-branch" title="if path not taken" >I</span>if(!id){
<span class="cstat-no" title="statement not covered" > ipc.log(</span>
@ -940,8 +963,9 @@ function connectNet(id,host,port,callback){
<span class="cstat-no" title="statement not covered" > UDPType=callback;</span>
<span class="cstat-no" title="statement not covered" > callback=false;</span>
}
<span class="missing-if-branch" title="if path not taken" >I</span>if(!callback)
<span class="missing-if-branch" title="if path not taken" >I</span>if(!callback){
<span class="cstat-no" title="statement not covered" > callback=<span class="fstat-no" title="function not covered" >function(){</span>};</span>
}
&nbsp;
<span class="missing-if-branch" title="if path not taken" >I</span>if(ipc.of[id]){
<span class="cstat-no" title="statement not covered" > if(!ipc.of[id].socket.destroyed){</span>
@ -973,7 +997,7 @@ module.exports=ipc;
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Jan 08 2016 21:50:31 GMT-0800 (PST)
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Sat Jan 09 2016 23:03:42 GMT-0800 (PST)
</div>
</div>
<script src="../prettify.js"></script>

View file

@ -1,18 +1,18 @@
TN:
SF:/home/bmiller/git/node-ipc/node-ipc.js
FN:56,log
FN:74,disconnect
FN:89,serve
FN:104,(anonymous_4)
FN:118,serveNet
FN:171,(anonymous_6)
FN:190,connect
FN:197,(anonymous_8)
FN:238,connectNet
FN:283,(anonymous_10)
FN:76,disconnect
FN:93,serve
FN:108,(anonymous_4)
FN:123,serveNet
FN:176,(anonymous_6)
FN:196,connect
FN:203,(anonymous_8)
FN:245,connectNet
FN:290,(anonymous_10)
FNF:10
FNH:6
FNDA:140,log
FNDA:141,log
FNDA:8,disconnect
FNDA:1,serve
FNDA:0,(anonymous_4)
@ -28,209 +28,209 @@ DA:22,1
DA:26,1
DA:44,1
DA:56,1
DA:57,140
DA:58,69
DA:60,71
DA:62,71
DA:63,229
DA:64,210
DA:66,19
DA:69,71
DA:74,1
DA:75,8
DA:76,0
DA:78,8
DA:80,8
DA:57,141
DA:58,70
DA:61,71
DA:63,71
DA:64,229
DA:65,210
DA:68,19
DA:71,71
DA:76,1
DA:77,8
DA:78,0
DA:81,8
DA:82,8
DA:83,8
DA:84,8
DA:85,8
DA:86,8
DA:89,1
DA:90,1
DA:91,1
DA:92,1
DA:90,8
DA:93,1
DA:94,1
DA:95,1
DA:100,1
DA:103,1
DA:104,0
DA:106,1
DA:112,1
DA:118,1
DA:119,3
DA:120,1
DA:121,1
DA:122,1
DA:96,1
DA:98,1
DA:99,1
DA:104,1
DA:107,1
DA:108,0
DA:111,1
DA:117,1
DA:123,1
DA:125,3
DA:124,3
DA:125,1
DA:126,1
DA:127,1
DA:128,1
DA:129,1
DA:131,3
DA:132,2
DA:130,3
DA:131,1
DA:132,1
DA:133,1
DA:134,1
DA:136,3
DA:137,2
DA:139,3
DA:140,0
DA:141,0
DA:142,0
DA:143,0
DA:146,3
DA:142,2
DA:144,3
DA:145,0
DA:146,0
DA:147,0
DA:148,0
DA:149,0
DA:151,3
DA:152,0
DA:153,0
DA:154,0
DA:156,3
DA:157,1
DA:157,0
DA:158,0
DA:159,0
DA:161,3
DA:162,1
DA:165,3
DA:166,0
DA:167,0
DA:167,1
DA:170,3
DA:171,0
DA:174,3
DA:181,3
DA:182,2
DA:184,3
DA:190,1
DA:191,4
DA:192,2
DA:193,2
DA:196,4
DA:197,0
DA:199,4
DA:200,0
DA:204,0
DA:207,4
DA:208,2
DA:213,2
DA:216,4
DA:217,0
DA:218,0
DA:223,0
DA:172,0
DA:175,3
DA:176,0
DA:179,3
DA:186,3
DA:187,2
DA:190,3
DA:196,1
DA:197,4
DA:198,2
DA:199,2
DA:202,4
DA:203,0
DA:206,4
DA:207,0
DA:211,0
DA:214,4
DA:215,2
DA:220,2
DA:223,4
DA:224,0
DA:226,0
DA:229,4
DA:230,4
DA:231,4
DA:233,4
DA:235,4
DA:238,1
DA:239,4
DA:240,0
DA:244,0
DA:225,0
DA:230,0
DA:231,0
DA:233,0
DA:236,4
DA:237,4
DA:238,4
DA:240,4
DA:242,4
DA:245,1
DA:246,4
DA:247,4
DA:248,4
DA:249,4
DA:251,4
DA:252,0
DA:253,0
DA:254,0
DA:247,0
DA:251,0
DA:253,4
DA:254,4
DA:255,4
DA:256,4
DA:257,4
DA:262,4
DA:265,4
DA:266,0
DA:267,0
DA:258,4
DA:259,0
DA:260,0
DA:261,0
DA:263,4
DA:264,4
DA:269,4
DA:270,0
DA:275,0
DA:278,4
DA:279,0
DA:280,0
DA:282,4
DA:283,0
DA:272,4
DA:273,0
DA:274,0
DA:276,4
DA:277,0
DA:282,0
DA:285,4
DA:286,0
DA:287,0
DA:292,0
DA:293,0
DA:289,4
DA:290,0
DA:293,4
DA:294,0
DA:295,0
DA:298,4
DA:299,4
DA:300,4
DA:301,4
DA:303,4
DA:305,4
DA:308,1
DA:300,0
DA:301,0
DA:303,0
DA:306,4
DA:307,4
DA:308,4
DA:309,4
DA:311,4
DA:313,4
DA:316,1
LF:135
LH:95
BRDA:29,1,0,0
BRDA:29,1,1,1
BRDA:57,2,0,69
BRDA:57,2,0,70
BRDA:57,2,1,71
BRDA:63,3,0,210
BRDA:63,3,1,19
BRDA:75,4,0,0
BRDA:75,4,1,8
BRDA:81,5,0,8
BRDA:81,5,1,0
BRDA:82,6,0,8
BRDA:82,6,1,0
BRDA:90,7,0,1
BRDA:90,7,1,0
BRDA:94,8,0,1
BRDA:94,8,1,0
BRDA:103,9,0,0
BRDA:103,9,1,1
BRDA:119,10,0,1
BRDA:119,10,1,2
BRDA:125,11,0,1
BRDA:125,11,1,2
BRDA:131,12,0,2
BRDA:131,12,1,1
BRDA:139,13,0,0
BRDA:139,13,1,3
BRDA:139,14,0,3
BRDA:139,14,1,3
BRDA:146,15,0,0
BRDA:146,15,1,3
BRDA:151,16,0,0
BRDA:151,16,1,3
BRDA:156,17,0,1
BRDA:156,17,1,2
BRDA:165,18,0,0
BRDA:165,18,1,3
BRDA:170,19,0,0
BRDA:170,19,1,3
BRDA:181,20,0,2
BRDA:181,20,1,1
BRDA:191,21,0,2
BRDA:191,21,1,2
BRDA:196,22,0,0
BRDA:196,22,1,4
BRDA:199,23,0,0
BRDA:199,23,1,4
BRDA:207,24,0,2
BRDA:207,24,1,2
BRDA:216,25,0,0
BRDA:216,25,1,4
BRDA:217,26,0,0
BRDA:217,26,1,0
BRDA:239,27,0,0
BRDA:239,27,1,4
BRDA:246,28,0,4
BRDA:246,28,1,0
BRDA:251,29,0,0
BRDA:251,29,1,4
BRDA:256,30,0,4
BRDA:256,30,1,0
BRDA:265,31,0,0
BRDA:265,31,1,4
BRDA:269,32,0,0
BRDA:269,32,1,4
BRDA:278,33,0,0
BRDA:278,33,1,4
BRDA:282,34,0,0
BRDA:282,34,1,4
BRDA:285,35,0,0
BRDA:285,35,1,4
BRDA:286,36,0,0
BRDA:286,36,1,0
BRDA:64,3,0,210
BRDA:64,3,1,19
BRDA:77,4,0,0
BRDA:77,4,1,8
BRDA:84,5,0,8
BRDA:84,5,1,0
BRDA:85,6,0,8
BRDA:85,6,1,0
BRDA:94,7,0,1
BRDA:94,7,1,0
BRDA:98,8,0,1
BRDA:98,8,1,0
BRDA:107,9,0,0
BRDA:107,9,1,1
BRDA:124,10,0,1
BRDA:124,10,1,2
BRDA:130,11,0,1
BRDA:130,11,1,2
BRDA:136,12,0,2
BRDA:136,12,1,1
BRDA:144,13,0,0
BRDA:144,13,1,3
BRDA:144,14,0,3
BRDA:144,14,1,3
BRDA:151,15,0,0
BRDA:151,15,1,3
BRDA:156,16,0,0
BRDA:156,16,1,3
BRDA:161,17,0,1
BRDA:161,17,1,2
BRDA:170,18,0,0
BRDA:170,18,1,3
BRDA:175,19,0,0
BRDA:175,19,1,3
BRDA:186,20,0,2
BRDA:186,20,1,1
BRDA:197,21,0,2
BRDA:197,21,1,2
BRDA:202,22,0,0
BRDA:202,22,1,4
BRDA:206,23,0,0
BRDA:206,23,1,4
BRDA:214,24,0,2
BRDA:214,24,1,2
BRDA:223,25,0,0
BRDA:223,25,1,4
BRDA:224,26,0,0
BRDA:224,26,1,0
BRDA:246,27,0,0
BRDA:246,27,1,4
BRDA:253,28,0,4
BRDA:253,28,1,0
BRDA:258,29,0,0
BRDA:258,29,1,4
BRDA:263,30,0,4
BRDA:263,30,1,0
BRDA:272,31,0,0
BRDA:272,31,1,4
BRDA:276,32,0,0
BRDA:276,32,1,4
BRDA:285,33,0,0
BRDA:285,33,1,4
BRDA:289,34,0,0
BRDA:289,34,1,4
BRDA:293,35,0,0
BRDA:293,35,1,4
BRDA:294,36,0,0
BRDA:294,36,1,0
BRF:72
BRH:44
end_of_record
@ -241,7 +241,7 @@ FN:15,parseDataEvents
FNF:2
FNH:2
FNDA:14,formatData
FNDA:15,parseDataEvents
FNDA:16,parseDataEvents
DA:1,1
DA:3,1
DA:4,14
@ -251,9 +251,9 @@ DA:8,0
DA:11,14
DA:12,14
DA:15,1
DA:16,15
DA:17,15
DA:18,15
DA:16,16
DA:17,16
DA:18,16
DA:21,1
DA:27,1
LF:14
@ -482,8 +482,8 @@ FNDA:0,(anonymous_13)
FNDA:4,serverCreated
FNDA:0,(anonymous_15)
FNDA:0,(anonymous_16)
FNDA:3,(anonymous_17)
FNDA:1,(anonymous_18)
FNDA:4,(anonymous_17)
FNDA:2,(anonymous_18)
FNDA:4,started
FNDA:0,(anonymous_20)
DA:1,1
@ -549,8 +549,8 @@ DA:134,1
DA:135,2
DA:136,2
DA:143,2
DA:144,1
DA:145,1
DA:144,0
DA:145,0
DA:148,0
DA:156,2
DA:159,2
@ -571,35 +571,35 @@ DA:199,4
DA:202,0
DA:204,0
DA:208,4
DA:211,3
DA:212,3
DA:211,4
DA:212,4
DA:213,0
DA:214,0
DA:219,0
DA:222,3
DA:223,3
DA:225,3
DA:227,3
DA:222,4
DA:223,4
DA:225,4
DA:227,4
DA:228,0
DA:229,0
DA:232,3
DA:234,3
DA:236,3
DA:237,3
DA:238,3
DA:240,3
DA:242,3
DA:243,3
DA:245,3
DA:232,4
DA:234,4
DA:236,4
DA:237,4
DA:238,4
DA:240,4
DA:242,4
DA:243,4
DA:245,4
DA:254,4
DA:257,1
DA:257,2
DA:258,0
DA:259,1
DA:260,1
DA:262,1
DA:259,2
DA:260,2
DA:262,2
DA:263,0
DA:265,1
DA:267,1
DA:265,2
DA:267,2
DA:271,4
DA:276,4
DA:277,0
@ -639,7 +639,7 @@ DA:356,0
DA:361,4
DA:364,1
LF:152
LH:85
LH:83
BRDA:16,1,0,0
BRDA:16,1,1,2
BRDA:22,2,0,2
@ -678,30 +678,30 @@ BRDA:117,18,0,0
BRDA:117,18,1,0
BRDA:118,19,0,0
BRDA:118,19,1,0
BRDA:143,20,0,1
BRDA:143,20,1,1
BRDA:143,20,0,0
BRDA:143,20,1,2
BRDA:157,21,0,1
BRDA:157,21,1,1
BRDA:185,22,0,2
BRDA:185,22,1,2
BRDA:211,23,0,1
BRDA:211,23,0,2
BRDA:211,23,1,2
BRDA:211,24,0,3
BRDA:211,24,1,2
BRDA:211,24,0,4
BRDA:211,24,1,3
BRDA:212,25,0,0
BRDA:212,25,1,3
BRDA:222,26,0,3
BRDA:212,25,1,4
BRDA:222,26,0,4
BRDA:222,26,1,0
BRDA:227,27,0,0
BRDA:227,27,1,3
BRDA:227,28,0,3
BRDA:227,28,1,3
BRDA:242,29,0,3
BRDA:227,27,1,4
BRDA:227,28,0,4
BRDA:227,28,1,4
BRDA:242,29,0,4
BRDA:242,29,1,0
BRDA:257,30,0,0
BRDA:257,30,1,1
BRDA:257,30,1,2
BRDA:262,31,0,0
BRDA:262,31,1,1
BRDA:262,31,1,2
BRDA:276,32,0,0
BRDA:276,32,1,4
BRDA:285,33,0,1
@ -725,5 +725,5 @@ BRDA:344,41,1,0
BRDA:349,42,0,0
BRDA:349,42,1,0
BRF:84
BRH:44
BRH:43
end_of_record

View file

@ -1,59 +1,59 @@
var ipc = require('../../../../node-ipc');
ipc.config.id ='testClient';
ipc.config.retry = 600;
ipc.config.id ='testClient';
ipc.config.retry = 600;
describe('TCP Socket verification of client',
function(){
it(
'Verify retry attempts by TCP client to connect to the server as per the value set in "maxRetries" parameter.',
function(done){
var tcpRetryAttempt = 3; //variable created to count the attempt made by client to connect to the server.
ipc.config.maxRetries = 3;
ipc.config.stopRetrying = false;
ipc.config.silent= false;
ipc.connectToNet(
'tcpFakeServer',
8002,
function(){
ipc.of.tcpFakeServer.on(
'disconnect',
function(){
if(ipc.of.tcpFakeServer.retriesRemaining == 0){
expect(tcpRetryAttempt).toBe(ipc.of.tcpFakeServer.retriesRemaining);
expect(ipc.of.tcpFakeServer.socket.destroyed).toBe(true);
}
else if(ipc.of.tcpFakeServer.retriesRemaining < 0){
expect(tcpRetryAttempt).not.toBeLessThan(0);
expect(ipc.of.tcpFakeServer.retriesRemaining).not.toBeLessThan(0);
ipc.of.tcpFakeServer.on(
'error',
function(err){
console.log('Error is: ', err);
ipc.disconnect('tcpFakeServer');
}
);
);
}
tcpRetryAttempt--;
tcpRetryAttempt--;
}
);
}
);
// Wait time is added to verify the fail case scenario of additional retry attempt by client than expected.
setTimeout(
function(){
@ -61,10 +61,10 @@ describe('TCP Socket verification of client',
done();
},2500
);
}
);
it(
'Verify TCP client does not connect to the TCPserver when "stopRetrying" value is set to true.',
function(done){
@ -99,11 +99,11 @@ describe('TCP Socket verification of client',
console.log('Error is: ', err);
ipc.disconnect('tcpFakeServer');
}
);
);
}
tcpRetryAttempt--;
tcpRetryAttempt--;
}
);
}
@ -118,7 +118,7 @@ describe('TCP Socket verification of client',
);
}
);
it(
'Verify TCP client connects to server named "tcpServer" and receives message.',
function(done){
@ -155,14 +155,14 @@ describe('TCP Socket verification of client',
);
}
);
it(
it(
'Verify TCP client queues the requests being sent to the server synchronously until it receives the response from server.',
function(done){
ipc.config.sync = true;
var responseCounter = 0;
ipc.connectToNet(
'tcpServerSync',
8400,
@ -170,27 +170,27 @@ describe('TCP Socket verification of client',
ipc.of.tcpServerSync.on(
'connect',
function(){
for(var i=0; i<5; i++){
ipc.of.tcpServerSync.emit(
'message',
{
id : ipc.config.id,
message : 'TCP Client Request '+ i
}
);
}
ipc.of.tcpServerSync.on(
'message',
function(data){
if (data.message != null){
responseCounter++;
responseCounter++;
expect(data.message).toBe('Response from TCP server');
}
if (responseCounter == 5){
expect(responseCounter).toBe(5);
ipc.disconnect('tcpServerSync');
@ -198,7 +198,7 @@ describe('TCP Socket verification of client',
}
}
);
ipc.of.tcpServerSync.on(
'error',
function(err){
@ -206,16 +206,15 @@ describe('TCP Socket verification of client',
ipc.disconnect('tcpServerSync');
}
);
}
);
}
);
}
);
}
);

View file

@ -1,13 +1,13 @@
var ipc = require('../../../../node-ipc');
ipc.config.id ='testWorld';
ipc.config.retry = 1000;
ipc.config.id ='testWorld';
ipc.config.retry = 1000;
describe('TCP Socket verification of server',
function(){
it(
it(
'Verify TCP server detects only 1 client out of 2 clients and receives message.',
function(done){
@ -43,6 +43,6 @@ describe('TCP Socket verification of server',
}
);
}
}
);

View file

@ -1,93 +1,92 @@
var ipc = require('../../../../node-ipc');
ipc.config.id ='testClient';
ipc.config.retry = 600;
ipc.config.id ='testClient';
ipc.config.retry = 600;
describe(
'UDP Socket verification.',
function(){
it(
'Verify UDP server of type udp4 connects to UDP server named "udp4Server" and receives message.',
function(done){
ipc.serveNet(
8001,
'udp4',
function(){
ipc.server.on(
'message',
function(data,socket){
expect(data.id).toBe('udpServer');
expect(data.message).toBe('I am UDP4 server!');
done();
}
);
ipc.server.emit(
{
address : 'localhost',
port : ipc.config.networkPort
},
'message',
{
id : ipc.config.id,
message : 'I am testClient'
}
);
ipc.server.on(
'error',
function(err){
console.log('Error is: ', err);
}
);
}
);
ipc.server.start();
}
);
it(
'Verify UDP server of type udp6 connects to UDP server named "udp6Server" and receives message.',
function(done){
'UDP Socket verification.',
function(){
it(
'Verify UDP server of type udp4 connects to UDP server named "udp4Server" and receives message.',
function(done){
ipc.serveNet(
8001,
'udp4',
function(){
ipc.server.on(
'message',
function(data,socket){
expect(data.id).toBe('udpServer');
expect(data.message).toBe('I am UDP4 server!');
done();
}
);
ipc.serveNet(
'::1',
8010,
'udp6',
function(){
ipc.server.on(
'message',
function(data,socket){
expect(data.id).toBe('udp6Server');
expect(data.message).toBe('I am UDP6 server!');
done();
}
);
ipc.server.emit(
{
address : 'localhost',
port : ipc.config.networkPort
},
'message',
{
id : ipc.config.id,
message : 'I am testClient'
}
);
ipc.server.on(
'error',
function(err){
console.log('Error is: ', err);
}
);
}
);
ipc.server.start();
}
);
}
);
ipc.server.emit(
{
address : 'localhost',
port : ipc.config.networkPort
},
'message',
{
id : ipc.config.id,
message : 'I am testClient'
}
);
ipc.server.on(
'error',
function(err){
console.log('Error is: ', err);
}
);
}
);
ipc.server.start();
}
);
it(
'Verify UDP server of type udp6 connects to UDP server named "udp6Server" and receives message.',
function(done){
ipc.serveNet(
'::1',
8010,
'udp6',
function(){
ipc.server.on(
'message',
function(data,socket){
expect(data.id).toBe('udp6Server');
expect(data.message).toBe('I am UDP6 server!');
done();
}
);
ipc.server.emit(
{
address : '::1',
port : 8099
},
'message',
{
id : ipc.config.id,
message : 'I am testClient'
}
);
ipc.server.on(
'error',
function(err){
console.log('Error is: ', err);
}
);
}
);
ipc.server.start();
}
);
}
);

View file

@ -1,13 +1,13 @@
var ipc = require('../../../../node-ipc');
ipc.config.id ='testClient';
ipc.config.retry = 600;
ipc.config.id ='testClient';
ipc.config.retry = 600;
describe('Test Cases for Unix client: ',
function(){
it(
it(
'Verify retry attempts by Unix client to connect to the Unix server as per the value set in "maxRetries" parameter.',
function(done){
@ -31,11 +31,11 @@ describe('Test Cases for Unix client: ',
}
else if(ipc.of.fakeworld.retriesRemaining < 0){
expect(retryAttempt).not.toBeLessThan(0);
expect(ipc.of.fakeworld.retriesRemaining).not.toBeLessThan(0);
expect(retryAttempt).not.toBeLessThan(0);
expect(ipc.of.fakeworld.retriesRemaining).not.toBeLessThan(0);
ipc.of.fakeworld.on(
ipc.of.fakeworld.on(
'error',
function(err){
console.log('Error is: ', err);
@ -43,9 +43,9 @@ describe('Test Cases for Unix client: ',
}
);
}
}
retryAttempt--;
retryAttempt--;
}
);
}
@ -63,7 +63,7 @@ describe('Test Cases for Unix client: ',
}
);
it(
it(
'Verify Unix client does not connect to the unix server when "stopRetrying" value is set to true.',
function(done){
@ -87,11 +87,11 @@ describe('Test Cases for Unix client: ',
}
else if(ipc.of.fakeworld.retriesRemaining < 3){
expect(retryAttempt).not.toBeLessThan(3);
expect(ipc.of.fakeworld.retriesRemaining).not.toBeLessThan(3);
expect(retryAttempt).not.toBeLessThan(3);
expect(ipc.of.fakeworld.retriesRemaining).not.toBeLessThan(3);
ipc.of.fakeworld.on(
ipc.of.fakeworld.on(
'error',
function(err){
console.log('Error is: ', err);
@ -99,9 +99,9 @@ describe('Test Cases for Unix client: ',
}
);
}
}
retryAttempt--;
retryAttempt--;
}
);
}
@ -118,14 +118,14 @@ describe('Test Cases for Unix client: ',
);
it(
it(
'Verify unix client connects to "unixServer" and receives message.',
function(done){
ipc.connectTo(
'unixServer',
'/tmp/app.unixServer',
function(){
ipc.of.unixServer.on(
ipc.of.unixServer.on(
'connect',
function(){
ipc.of.unixServer.emit(
@ -162,7 +162,7 @@ describe('Test Cases for Unix client: ',
}
);
it(
it(
'Verify unix client queues the requests being sent to the server synchronously until it receives the response from server.',
function(done){
@ -173,7 +173,7 @@ describe('Test Cases for Unix client: ',
'unixServerSync',
'/tmp/app.unixServerSync',
function(){
ipc.of.unixServerSync.on(
ipc.of.unixServerSync.on(
'connect',
function(){
@ -192,10 +192,10 @@ describe('Test Cases for Unix client: ',
ipc.of.unixServerSync.on(
'message',
function(data){
if (data.message != null){
if (data.message != null){
responseCounter++;
expect(data.message).toBe('Response from unix server');
}
}
if (responseCounter == 5){
expect(responseCounter).toBe(5);
@ -220,6 +220,6 @@ describe('Test Cases for Unix client: ',
}
);
// End of test cases for Unix
}
}
);

View file

@ -1,13 +1,13 @@
var ipc = require('../../../../node-ipc');
ipc.config.id ='testWorld';
ipc.config.retry = 1000;
ipc.config.id ='testWorld';
ipc.config.retry = 1000;
describe('Test Cases for server: ',
function(){
// Unix server verification //
it(
it(
'Verify unix server detects only 1 client out of 2 clients and receives message.',
function(done){
@ -42,6 +42,6 @@ describe('Test Cases for server: ',
}
);
}
}
);

View file

@ -1,38 +1,35 @@
var ipc=require('../../../node-ipc');
const ipc=require('../../../node-ipc');
const process=require('process');
const dieAfter=60000;
ipc.config.id = 'tcpClient';
//die after 60 seconds
setTimeout(
function killServerProcess(){
process.exit(0);
},
dieAfter
);
ipc.config.id = 'tcpClient';
ipc.config.retry= 600;
ipc.config.silent=true;
ipc.config.networkPort=8500;
ipc.connectToNet(
'tcpClient',
8500,
function(){
function opened(){
ipc.of.tcpClient.on(
'connect',
function(){
function connected(){
ipc.of.tcpClient.emit(
'app.message',
{
id : ipc.config.id,
message : 'I am TCP client.'
}
)
);
}
);
ipc.of.tcpClient.on(
'disconnect',
function(){
ipc.log('disconnected from world'.notice);
}
);
ipc.of.tcpClient.on(
'app.message',
function(data){
ipc.log('got a message from world : '.debug, data.message);
}
);
}
);

View file

@ -1,29 +1,31 @@
var ipc=require('../../../node-ipc');
const ipc=require('../../../node-ipc');
const process=require('process');
const dieAfter=60000;
/***************************************\
*
* You should start both hello and world
* then you will see them communicating.
*
* *************************************/
//die after 60 seconds
setTimeout(
function killServerProcess(){
process.exit(0);
},
dieAfter
);
ipc.config.id = 'tcpServer';
ipc.config.id = 'tcpServer';
ipc.config.retry= 1500;
ipc.config.networkPort =8300;
ipc.config.networkPort=8300;
ipc.config.silent=true;
ipc.serveNet(
function(){
function serverStarted(){
ipc.server.on(
'message',
function(data,socket){
function gotMessage(data,socket){
ipc.server.emit(
socket,
'message',
{
id : ipc.config.id,
message : 'I am TCP server!'
}
);
}
@ -31,5 +33,4 @@ ipc.serveNet(
}
);
ipc.server.start();

View file

@ -1,34 +1,38 @@
var ipc=require('../../../node-ipc');
const ipc=require('../../../node-ipc');
const process=require('process');
const dieAfter=60000;
const messageDelay=900;
/***************************************\
*
* You should start both hello and world
* then you will see them communicating.
*
* *************************************/
//die after 60 seconds
setTimeout(
function killServerProcess(){
process.exit(0);
},
dieAfter
);
ipc.config.id = 'tcpServerSync';
ipc.config.id = 'tcpServerSync';
ipc.config.retry= 1500;
ipc.config.networkPort = 8400;
ipc.config.silent=true;
ipc.serveNet(
function(){
function serverStarted(){
ipc.server.on(
'message',
function(data,socket){
setTimeout(
function(){
ipc.server.emit(
function gotMessage(data,socket){
setTimeout(
function delayedMessage(){
ipc.server.emit(
socket,
'message',
{
id : ipc.config.id,
message : 'Response from TCP server'
}
{
id : ipc.config.id,
message : 'Response from TCP server'
}
);
},900
},
messageDelay
);
}
);

View file

@ -1,17 +1,16 @@
var cmd=require('node-cmd');
const cmd=require('node-cmd');
cmd.run('node '+ __dirname + '/unixServer.js');
cmd.run('node '+ __dirname + '/unixServerSync.js');
cmd.run(`node ${__dirname}/unixServer.js`);
cmd.run(`node ${__dirname}/unixServerSync.js`);
cmd.run('node '+ __dirname + '/udp4Server.js');
cmd.run('node '+ __dirname + '/udp6Server.js');
cmd.run(`node ${__dirname}/udp4Server.js`);
cmd.run(`node ${__dirname}/udp6Server.js`);
cmd.run('node '+ __dirname + '/tcpServer.js');
cmd.run('node '+ __dirname + '/tcpServerSync.js');
cmd.run(`node ${__dirname}/tcpServer.js`);
cmd.run(`node ${__dirname}/tcpServerSync.js`);
cmd.run('node '+ __dirname + '/unixClient.js');
cmd.run('node '+ __dirname + '/unixClient.js');
cmd.run('node '+ __dirname + '/tcpClient.js');
cmd.run('node '+ __dirname + '/tcpClient.js');
cmd.run(`node ${__dirname}/unixClient.js`);
cmd.run(`node ${__dirname}/unixClient.js`);
cmd.run(`node ${__dirname}/tcpClient.js`);
cmd.run(`node ${__dirname}/tcpClient.js`);

View file

@ -1,46 +1,35 @@
var ipc=require('../../../node-ipc');
const ipc=require('../../../node-ipc');
const process=require('process');
const dieAfter=60000;
/***************************************\
*
* Since there is no client relationship
* with UDP sockets sockets are not kept
* open.
*
* This means the order sockets are opened
* is important.
*
* Start World first. Then you can start
* hello or goodbye in any order you
* choose.
*
***************************************/
//die after 60 seconds
setTimeout(
function killServerProcess(){
process.exit(0);
},
dieAfter
);
ipc.config.id = 'udpServer';
ipc.config.id = 'udpServer';
ipc.config.retry= 1500;
ipc.config.silent=true;
ipc.serveNet(
'udp4',
function(){
function serverStarted(){
ipc.server.on(
'message',
function(data,socket){
function gotMessage(data,socket){
ipc.server.emit(
socket,
'message',
{
id : ipc.config.id,
message : 'I am UDP4 server!'
}
);
}
);
}
);

View file

@ -1,45 +1,37 @@
var ipc=require('../../../node-ipc');
const ipc=require('../../../node-ipc');
const process=require('process');
const dieAfter=60000;
/***************************************\
*
* Since there is no client relationship
* with UDP sockets sockets are not kept
* open.
*
* This means the order sockets are opened
* is important.
*
* Start World first. Then you can start
* hello or goodbye in any order you
* choose.
*
***************************************/
//die after 60 seconds
setTimeout(
function killServerProcess(){
process.exit(0);
},
dieAfter
);
ipc.config.id = 'udp6Server';
ipc.config.id = 'udp6Server';
ipc.config.retry= 1500;
ipc.config.silent=true;
ipc.config.networkPort=8099;
ipc.serveNet(
'::1',
'udp6',
function(){
function serverStarted(){
ipc.server.on(
'message',
function(data,socket){
function gotMessage(data,socket){
ipc.server.emit(
socket,
'message',
{
id : ipc.config.id,
message : 'I am UDP6 server!'
}
);
}
);
}
);

View file

@ -1,38 +1,34 @@
var ipc=require('../../../node-ipc');
const ipc=require('../../../node-ipc');
const process=require('process');
const dieAfter=60000;
ipc.config.id = 'unixClient';
//die after 60 seconds
setTimeout(
function killServerProcess(){
process.exit(0);
},
dieAfter
);
ipc.config.id = 'unixClient';
ipc.config.retry= 600;
ipc.config.silent=true;
ipc.connectTo(
'testWorld',
'/tmp/app.testWorld',
function(){
function opened(){
ipc.of.testWorld.on(
'connect',
function(){
function connected(){
ipc.of.testWorld.emit(
'message',
{
id : ipc.config.id,
message : 'I am unix client.'
}
)
);
}
);
ipc.of.testWorld.on(
'disconnect',
function(){
ipc.log('disconnected from testWorld'.notice);
}
);
ipc.of.testWorld.on(
'message',
function(data){
ipc.log('got a message from testWorld : '.debug, data);
}
);
}
);

View file

@ -1,28 +1,31 @@
var ipc=require('../../../node-ipc');
const ipc=require('../../../node-ipc');
const process=require('process');
const dieAfter=60000;
/***************************************\
*
* You should start both hello and world
* then you will see them communicating.
*
* *************************************/
//die after 60 seconds
setTimeout(
function killServerProcess(){
process.exit(0);
},
dieAfter
);
ipc.config.id = 'unixServer';
ipc.config.id = 'unixServer';
ipc.config.retry= 1500;
ipc.config.silent=true;
ipc.serve(
function(){
function serverStarted(){
ipc.server.on(
'message',
function(data,socket){
function gotMessage(data,socket){
ipc.server.emit(
socket,
'message',
{
id : ipc.config.id,
message : 'I am unix server!'
}
);
}

View file

@ -1,22 +1,27 @@
var ipc=require('../../../node-ipc');
const ipc=require('../../../node-ipc');
const process=require('process');
const dieAfter=60000;
const messageDelay=900;
/***************************************\
*
* You should start both hello and world
* then you will see them communicating.
*
* *************************************/
//die after 60 seconds
setTimeout(
function killServerProcess(){
process.exit(0);
},
dieAfter
);
ipc.config.id = 'unixServerSync';
ipc.config.id = 'unixServerSync';
ipc.config.retry= 1500;
ipc.config.silent=true;
ipc.serve(
function(){
function serverStarted(){
ipc.server.on(
'message',
function(data,socket){
function gotMessage(data,socket){
setTimeout(
function(){
function delayedMessage(){
ipc.server.emit(
socket,
'message',
@ -25,7 +30,8 @@ ipc.serve(
message : 'Response from unix server'
}
);
},900
},
messageDelay
);
}
);