From 46c86f3da21c3ee64cf5b9179915c995e3f69e58 Mon Sep 17 00:00:00 2001 From: Brandon Miller Date: Thu, 27 Feb 2014 12:04:30 -0800 Subject: [PATCH] udp and TCP support --- node-ipc.js | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/node-ipc.js b/node-ipc.js index 47081a0..1545246 100644 --- a/node-ipc.js +++ b/node-ipc.js @@ -3,8 +3,7 @@ var os = require('os'), pubsub = require('event-pubsub'), eventParser = require('./lib/eventParser.js'), Client = require('./lib/client.js'), - Server = require('./lib/socketServer.js'), - socketPrefix= 'app.'; + Server = require('./lib/socketServer.js'); colors.setTheme( { @@ -19,8 +18,7 @@ colors.setTheme( ); var defaults={ - root : process.env.HOME, - appspace : socketPrefix, + appspace : 'app.', socketRoot : '/tmp/', networkHost : 'localhost', networkPort : 8000, @@ -201,7 +199,7 @@ function connect(id,path,callback){ callback(); } -function connectNet(id,host,port,callback,UDPType){ +function connectNet(id,host,port,callback){ if(!id){ ipc.log( 'Service id required'.warn, @@ -210,23 +208,15 @@ function connectNet(id,host,port,callback,UDPType){ return; } if(typeof host=='number'){ - UDPType=callback; callback=port; port=host; host=false; } if(typeof host=='function'){ - UDPType=port; callback=host; host=false; port=false; } - if(host=='udp4' || host=='udp6'){ - UDPType=host; - host=false; - port=false; - callback=false; - } if(!host){ ipc.log( 'Server host not specified, so defaulting to'.notice, @@ -237,15 +227,9 @@ function connectNet(id,host,port,callback,UDPType){ } if(typeof port=='function'){ - UDPType=callback; callback=port; port=false; } - if(typeof port == 'string'){ - UDPType=port; - port=false; - callback=false; - } if(!port){ ipc.log( 'Server port not specified, so defaulting to'.notice,