Broadcast UDP message

Lucas Robsahm <>
Wed Jun 10 16:53:26 CEST 2009


Hi!

I'm trying to send a broadcast message to 255.255.255.255 but I can't
get it to work.
My IP-Address is 192.168.1.1 and it's ok to send UDP message to
192.168.1.255 but I need to send it to 255.255.255.255.

{ok, Socket} = gen_udp:open(0, [binary, {broadcast, true}]),
ok = gen_udp:send(Socket, {255, 255, 255, 255}, 68, Message).

The result of this is badmatch, {error, enetunreach}.

What's wrong? 
How can i broadcast UDP messages?

//Lucas


More information about the erlang-questions mailing list