Revision: 10361 http://pure-data.svn.sourceforge.net/pure-data/?rev=10361&view=rev Author: mrpeach Date: 2008-11-05 19:06:23 +0000 (Wed, 05 Nov 2008)
Log Message: ----------- Added broadcast permission to sockets as suggested by zmoelnig's patch 2221504
Modified Paths: -------------- trunk/externals/mrpeach/net/udpsend.c
Modified: trunk/externals/mrpeach/net/udpsend.c =================================================================== --- trunk/externals/mrpeach/net/udpsend.c 2008-11-05 08:55:38 UTC (rev 10360) +++ trunk/externals/mrpeach/net/udpsend.c 2008-11-05 19:06:23 UTC (rev 10361) @@ -50,6 +50,7 @@ struct hostent *hp; int sockfd; int portno = fportno; + int broadcast = 1;/* nonzero is true */
if (x->x_fd >= 0) { @@ -67,6 +68,15 @@ sys_sockerror("udpsend: socket"); return; } +/* 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))) + { + pd_error(x, "couldn't switch to broadcast mode"); + } +#endif /* SO_BROADCAST */ + /* connect socket using hostname provided in command line */ server.sin_family = AF_INET; hp = gethostbyname(hostname->s_name);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.