Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

Writing DHCP client/server in JAVA

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would like to bulid something that has DHCP functionality. However, I found the API of java are all on top of layer 3. Whenever it creates a socket, it binds to an IP and a port. In such case, how can I implement DHCP (if without native code?) Any idea?
In particular in client side,
I design a DHCPMessage class to represent DHCP packet
I send a DHCP Discover message to a broadcast address 255.255.255.255, with my MAC address
I used Ethereal to dump packets on the Ethernet
I find my DHCP Discover packets successfully sending out, and the DHCP server in my LAN replies with a DHCP Offer message to my MAC address.
However, my client cannot receive it although the MAC address and port is correct, it contains no IP
Any ideas how to solve?
 
author and iconoclast
Posts: 24204
44
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Indeed. Java doesn't offer sufficiently low-level access to the network stack to implement DHCP in 100% Java -- you would need to use native methods (or a library that itself uses native methods.)
 
Message for you sir! I think it is a tiny ad:
Garden Master Course kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic