net-dhcp

0.3.0 • Public • Published

DHCP

npm npm license npm downloads build status

Dynamic Host Configuration Protocol (DHCP)

Install via npm

$ npm install --save net-dhcp

NOTE: This is still a work-in-progress; only message receipt and parsing is implemented at the time. The plan is to arrive at a fully functioning DHCP client & server implementation.


Examples

  • example/monitor: Monitor the network for DHCP messages

Usage

var DHCP = require( 'net-dhcp' )

Client

var client = new DHCP.Client()
 
client.on( 'error', ( error ) => {
  console.log( error )
})
 
client.on( 'message', ( message, rinfo ) => {
  console.log( 'Message from', rinfo, message )
})
 
client.on( 'listening', ( socket ) => {
  console.log( 'Listening on', socket.address() )
})
 
client.listen()

Server

var server = new DHCP.Server()
 
server.on( 'error', ( error ) => {
  console.error( '[ERROR]', error )
})
 
// Warnings are emitted if a received packet could not be decoded
server.on( 'warning', ( error, rinfo, rawMessage ) => {
  console.error( '[WARN]', rinfo, error )
})
 
server.on( 'message', ( message, rinfo ) => {
  console.log( 'Client message from', rinfo, message )
})
 
server.on( 'listening', ( socket ) => {
  console.log( 'Server listening on', socket.address() )
})
 
server.listen()

References

Dependents (0)

Package Sidebar

Install

npm i net-dhcp

Weekly Downloads

0

Version

0.3.0

License

MIT

Unpacked Size

28 kB

Total Files

8

Last publish

Collaborators

  • jhermsmeier