Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

easyip

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

easyip - npm Package Compare versions

Comparing version 0.1.1 to 0.2.0

examples/server.js

41

easyip.js

@@ -20,3 +20,3 @@ /*!

*/
function Service(bind_port){
function Service(){
EventEmitter.call(this);

@@ -26,3 +26,2 @@ var m=this;

this.counter = 0;
this.bind_port = bind_port;
var server = dgram.createSocket("udp4");

@@ -53,3 +52,3 @@ m.server = server;

if (typeof(fn) !== 'undefined'){
fn(null, packet);
fn(null, packet, rinfo);
}

@@ -143,8 +142,14 @@ delete request_dict[packet.header.COUNTER];

/**
* Binds the service to the previously defined port
* Binds the service to a defined or default port
* if you don't run as root with the default port
* you will get a 'bind EACCES' error.
*
* @param {Number} Optional port number to bind to. default=EASYIP_PORT, 0 - gives a random port
*
* @api public
*/
Service.prototype.bind = function(){
this.server.bind(this.bind_port);
Service.prototype.bind = function(bind_port){
if(typeof(bind_port)==='undefined'){ bind_port = EASYIP_PORT;}
this.bind_port = bind_port;
this.server.bind(bind_port);
};

@@ -207,2 +212,3 @@

h.packTo(buf, 0);
this.server.send(buf, 0, buf.length, address.port, address.address, function(err, sent){

@@ -220,3 +226,3 @@ if(err){

* Send data from local storage to remote address.
* @param {Object} {address:<address>, port:<number>}
* @param {Object}/{String} {address:<address>, port:<number>} / 'ipaddress or hostname'
* @param {Number} OPERANDS datatype to send from local storage

@@ -228,2 +234,4 @@ * @param {Number} Start address at remote

*
* @callback (err, packet, rinfo)
*
* @api public

@@ -236,2 +244,5 @@ */

var index;
if(typeof(address)=='string'){
address = {address:address, port:EASYIP_PORT};
}
h.COUNTER=this.getCounter();

@@ -250,2 +261,3 @@ h.SEND_TYPE=operand;

var l = p.packTo(buf, 0);
this.server.send(buf, 0, l, address.port, address.address, function(err, sent){

@@ -260,17 +272,6 @@ if(err){

/**
* bind_port = 0 - gives a random port
* undefined tries to use the EASYIP_PORT or < 1024 and if not run as root
* you will get a 'bind EACCES' error.
* @param {Number} Optional port number to bind to
*
* @api public
*/
exports.createService = function(bind_port){
if(typeof(bind_port)==='undefined'){ bind_port = EASYIP_PORT;}
return new Service(bind_port);
};
exports.VERSION='0.2.0';
exports.Service = Service;
exports.OPERANDS = enums.OPERANDS;
exports.FLAGS = enums.FLAGS;
exports.EASYIP_PORT = EASYIP_PORT;

@@ -5,3 +5,3 @@ {

"description": "Node library for the Fest Easy-IP protocoll",
"version": "0.1.1",
"version": "0.2.0",
"homepage": "http://github.com/birchroad/node-easyip",

@@ -8,0 +8,0 @@ "repository": {

@@ -20,4 +20,4 @@ /*!

},
'has createService function':function(mod){
assert.isFunction(mod.createService);
'has Service constructor':function(mod){
assert.isFunction(mod.Service);
},

@@ -29,3 +29,3 @@ 'has OPERANDS': function(mod){

topic:function(mod){
var s = mod.createService(0);
var s = new mod.Service();
return s

@@ -50,4 +50,4 @@ },

topic:function(){
var server = easyip.createService(1000 + easyip.EASYIP_PORT);
server.bind();
var server = new easyip.Service();
server.bind(1000 + easyip.EASYIP_PORT);
server.flagwords[0]=10;

@@ -71,4 +71,4 @@ server.flagwords[1]=11;

topic:function(){
var server = easyip.createService(2000 + easyip.EASYIP_PORT);
server.bind();
var server = new easyip.Service();
server.bind(2000 + easyip.EASYIP_PORT);
var self = this;

@@ -75,0 +75,0 @@ var t = setTimeout(function(){

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc