Skip to content

Dynamic Host Configuration Protocol (DHCP)

License

Notifications You must be signed in to change notification settings

jhermsmeier/node-net-dhcp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Dynamic Host Configuration Protocol (DHCP)

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published