in reply to Re^4: Sending AND Receiving on the Same Port
in thread Sending AND Receiving on the Same Port
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.
|
|---|