[erlang-questions] Sending UDP messages without IP

Lucas Robsahm lucas.robsahm@REDACTED
Wed Jun 10 08:21:32 CEST 2009


>>Lucas Robsahm wrote:
>> Hi!
>> 
>> I'm trying to get a dhcp-server
>> (http://code.google.com/p/erlang-dhcp-server/) to work but right now 
>> I'm not able to answer on the broadcasted dhcp-discover message
that's 
>> sent from IP 0.0.0.0.
>> When I use a sniffer on the network-devices dhcp-offer message is
sent 
>> from 127.0.0.1 to 127.0.0.1, I guess that's the way Erlang or Linux 
>> handle messages to 0.0.0.0.
>> 
>> Is there any way to send UDP messages from Erlang to a computer 
>> without IP-address set?
>> Is it possible to modify the ARP? I guess that would solve my problem

>> somehow.
>> 
>> //Lucas
>> 

>Yes, using UDP broadcast.

>{ok, Socket} = gen_udp:open(0, [binary, {broadcast, true}]),
gen_udp:send(Socket, {255,255,255,255}, ?PORT, Data),

When I try, I get {error, enetunreach}. 
No ICMP message sent from the switch, so I guess it's my computer that
can't find the destination (http://www.wlug.org.nz/ENETUNREACH).


More information about the erlang-questions mailing list