I have to specify it's for broadcasting [...] doesn't that change the nature of the socket?

I think it simply allows it to broadcast and receive broadcasts.

What catches my eye is that you chose to connect to INADDR_BROADCAST. Connecting a UDP socket (i.e. specifying PeerAddr) means you can only receive from the address to which you connect. What does it mean to connect to INADDR_BROADCAST? ( Can only receive broadcasts ) Do you have to connect to INADDR_BROADCAST? ( no ) Will test tomorrow.

I don't see a method in IO::Socket::INET or IO::Socket that lets me change the Broadcast flag to 0 after I send a broadcast.

Since Broadcast=>1 does

$sock->sockopt(SO_BROADCAST,1)

the approach would be

$sock->sockopt(SO_BROADCAST,0)

But again, I don't think this is necessary.


In reply to Re^5: Sending AND Receiving on the Same Port by ikegami
in thread Sending AND Receiving on the Same Port by HalNineThousand

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.