Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6178081
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T00:24:12+00:00 2026-05-24T00:24:12+00:00

I’m trying to create a DHCP Client using Java. The client will send Discover,

  • 0

I’m trying to create a DHCP Client using Java.
The client will send Discover, receive a Offer, send a Request, and receive an Ack.
However, when sending the discver and the request UDP DatagramPackets, I need to send them from the IP 0.0.0.0 port 68 because, the point of DHCP is is to receive a usable IP address from the DHCP Server.
However, If I bind my socket to a 0.0.0.0, according to the http://download.oracle.com/javase/6/docs/api/java/net/DatagramSocket.html Java Reference, the kernel will assign a IP address to the socket.

If I force set the IP address of my ethernet card to 0.0.0.0 via the

$ sudo ifconfig en0 0.0.0.0  

and send my Packet; I receive a

java.io.IOException: Can't assign requested address

Exception.

Is there a way to send UDP packets from a 0.0.0.0 and set through System.exec() (if required) the IP address received from the DHCP server using Java?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T00:24:13+00:00Added an answer on May 24, 2026 at 12:24 am

    It may be that you won’t be able to use this library to do DHCP. The library assumes that you won’t want to use 0.0.0.0 as the sender address, even though DHCP specifies that you shouldn’t put an ip address there. Just scanning the RFC, it seems to indicate that you “shouldn’t fill out the sender field.” Is it possible that it’ll just be ignored? It may be that since DHCP is all broadcast, it won’t matter and you can just fill out anything. Have you tried listening to DHCP requests on Wireshark or another packet sniffer to see if its really 0.0.0.0?

    You may have to build your datagrams at a lower level.

    I don’t think it will matter how your own IP address is set if you’re using DatagramSocket, because the library is going to change it if you try and assign 0.0.0.0.

    Edit:
    I scanned through parts of the dhclient source, and its huge and I don’t understand it, but it looks like they are using shell scripts to configure the interfaces using ifconfig. So that may answer that part of the question. So you can just use your ifconfig to change your IP address as you are now.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I am trying to understand how to use SyndicationItem to display feed which is
I am trying to loop through a bunch of documents I have to put
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I'm making a simple page using Google Maps API 3. My first. One marker

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.