Check for running DHCP daemon?
rosuav at gmail.com
Sat Jan 24 00:39:25 CET 2015
On Sat, Jan 24, 2015 at 10:21 AM, <sohcahtoa82 at gmail.com> wrote:
> On Friday, January 23, 2015 at 2:50:12 PM UTC-8, Chris Angelico wrote:
>> On Sat, Jan 24, 2015 at 9:38 AM, <sohcahtoa82 at gmail.com> wrote:
>> > Secondly, even if you find a module, keep in mind that the module probably won't stay in Python land. It will probably call an external utility itself.
>> > If you REALLY wanted to check it without calling an external utility, you could connect to port 67 and see what happens, but that could cause problems.
>> We're talking UDP here, so there's no "connect to" concept. You have
>> to send a packet and listen for a reply, and that might have
>> consequences (eg if you send a DHCPDISCOVER just to find out if
>> there's a DHCP server, you potentially cause a temporary IP
>> Reading from /proc or running an external program would be the best
>> ways to find out.
> I forgot that DHCP uses UDP. My mistake.
Yeah, it's usually easier to probe a TCP service. You can either
connect to it, or - often - simply try to bind to the same port, as
you'll usually get an error. Not always, though, so connecting is the
More information about the Python-list