infusion / node-dhcp

A DHCP server and client written in pure JavaScript
https://raw.org/article/a-pure-javascript-dhcp-implementation/
MIT License
301 stars 75 forks source link

trying to get sock.address() data in to global variable #68

Closed HUFGhani closed 2 years ago

HUFGhani commented 4 years ago

I've been following the example code, below :

  var address = sock.address();
  console.info('Server Listening: ' + address.address + ':' + address.port);
});

however, I want to get the data out of sock.address() in to global variable like this

var address = null
s.on("listening", function(sock) {
  address = sock.address();
});

console.log(address)

however, I get undefined from it any idea what can I do.