On 10/05/11 01:40 PM, Matteo Sisti Sette wrote:
On 05/10/2011 06:56 PM, Martin wrote:
I don't have any trouble here with [udpsend] and debian lenny.
I don't have any trouble with [udpsend] either. It's [netsend 1] that can't broadcast (neither in Pd Vanilla 0.42.5 nor Pd Extended 0.42.5)
Any time you get permission denied it's up to you to set the permissions. (If a program could do that, why have permissions at all?)
That sounds very reasonable, but then how comes that [udpsend] can broadcast packets and [netsend 1] can't (on the same system, same machine, I've tried both right now)?
My guess is that either A) [netsend 1] is doing something wrong, trying to do something that is not really necessary and that requires some permissions that the program doesn't have B) it is printing a wrong error message and the failure is not really due to a denied permission.
OK I see now. [udpsend] has this in it right after the socket is created:
/* Based on zmoelnig's patch 2221504: Enable sending of broadcast messages (if hostname is a broadcast address)*/ #ifdef SO_BROADCAST if( 0 != setsockopt(sockfd, SOL_SOCKET, SO_BROADCAST, (const void *)&broadcast, sizeof(broadcast))) { udpsend_sock_err(x, "couldn't switch to broadcast mode"); } #endif /* SO_BROADCAST */
...and broadcast is just an int: int broadcast = 1;/* nonzero is true */
I guess if something like that were to be added to the netsend_connect function it would work.
Martin