<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#ffffff">
    I must admit I hadn't tried that because I read that a broadcast
    socket could not be used to listen on. However, if it can that would
    solve the issue.<br>
    <br>
    <br>
    On 27/04/2011 21:22, Ahmed Omar wrote:
    <blockquote
      cite="mid:BANLkTik7t5KAiSecD=0cMHJ_+_Kiz8dXKA@mail.gmail.com"
      type="cite">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 moz-do-not-send="true"
                href="mailto:bob@bobcowdery.plus.com">bob@bobcowdery.plus.com</a>></span>
            wrote:<br>
            <blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt
              0.8ex; border-left: 1px solid rgb(204, 204, 204);
              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 moz-do-not-send="true"
                href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
              <a moz-do-not-send="true"
                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 moz-do-not-send="true"
              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 moz-do-not-send="true"
              href="http://twitter.com/#%21/spawn_think" target="_blank">@spawn_think</a></div>
          <br>
        </div>
      </div>
    </blockquote>
    <br>
  </body>
</html>