www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.ide
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.DMDScript
electronics




digitalmars.D - Datagram Networking Not Getting any Data?

↑ ↓ ← Andrew Wiley <debio264 gmail.com> writes:
Content-Type: text/plain

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 03 2008
↑ ↓ → e-t172 <e-t172 akegroup.org> writes:
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.
May 04 2008