May 04, 2008 Datagram Networking Not Getting any Data? | ||||
|---|---|---|---|---|
| ||||
Attachments: | I'm trying to write a DHCP server. Yes, I'm reinventing the wheel, but... why is another post. The problem isn't the protocol or understanding how it works. The problem is getting my program to receive DHCP requests, which are UDP packets sent to 255.255.255.255 to port 67. Attached is my main loop to receive packets. You can see where I have basically removed all packet processing. It looks like it should just print "Packet!" whenever a UDP packet arrives on port 67, but it doesn't. My highly scientific test here was to start the program and force my laptop to get a new IP address. Wireshark monitoring on my laptop confirms that there are request packets going to 255.255.255.255:67, but the program just sits there. What's going on? | |||
May 04, 2008 Re: Datagram Networking Not Getting any Data? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Andrew Wiley | Andrew Wiley a écrit :
> The problem isn't the protocol or understanding how it works. The problem is getting my program to receive DHCP requests, which are UDP packets sent to 255.255.255.255 to port 67. Attached is my main loop to receive packets. You can see where I have basically removed all packet processing. It looks like it should just print "Packet!" whenever a UDP packet arrives on port 67, but it doesn't.
You need to set the SO_BROADCAST flag in the socket. Use Socket.setOption() to do this, with SocketOption.SO_BROADCAST.
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply