Why do you need to close and open the socket again? Why don't you just do<div>gen_udp:open(6000, [binary, {broadcast, true},{active, false}]).</div><div>?<br><div><br><br><div class="gmail_quote">On Wed, Apr 27, 2011 at 9:52 PM, Bob Cowdery <span dir="ltr"><<a href="mailto:bob@bobcowdery.plus.com">bob@bobcowdery.plus.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">I don't think this is an Erlang issue. I'm probably just doing it wrong.<br>
Any advice would be gratefully received.<br>
<br>
My app does a UDP broadcast and expects a reply from a piece of<br>
hardware. As I understand broadcast it involves opening a broadcast socket.<br>
<br>
    gen_udp:open(6000, [binary, {broadcast, true}])<br>
<br>
doing the broadcast. Then closing the socket and opening a listening socket.<br>
<br>
    gen_udp:open(6000, [binary, {active, false}])<br>
<br>
I've had the application working against a simulator, but the hardware<br>
is a lot faster. Using wireshark I can see my broadcast go and the reply<br>
come back. The problem is I miss the reply because by the time I close<br>
the socket and open a new one its too late. I can't help feeling I must<br>
be doing something fundamentally wrong here or broadcasts just wouldn't<br>
work.<br>
<br>
Thanks<br>
Bob<br>
_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>Best Regards,<br>- Ahmed Omar<div><a href="http://nl.linkedin.com/in/adiaa" target="_blank">http://nl.linkedin.com/in/adiaa</a></div><div>Follow me on twitter</div><div><a href="http://twitter.com/#!/spawn_think" target="_blank">@spawn_think</a></div>
<br>
</div></div>