[Pharo-dev] UDP Broadcast message

Sven Van Caekenberghe sven at stfx.eu
Thu Dec 19 10:40:57 EST 2013


You also have to set a port with #setPort: no ?

On 19 Dec 2013, at 16:39, jannik.laval <jannik.laval at gmail.com> wrote:

> And here is my small example code:
> 
> udpSocket := Socket newUDP.
> udpSocket setOption: 'SO_BROADCAST' value: true.
> udpSocket getOption: 'SO_BROADCAST'.
> udpSocket receiveDataTimeout: 15.
> 
> 
> Jannik
> 
> On Dec 19, 2013, at 4:29 PM, jannik.laval <jannik.laval at gmail.com> wrote:
> 
>> Ok, here is my situation:
>> 
>> - I have a Lego Mindstorm that broadcast a UDP message every 10 seconds.
>> - With Wireshark I can see the UDP message, so no problem with that.
>> - I tried to set the option SO_BROADCAST, it does not work anymore.
>> 
>> Any other idea ?
>> 
>> Jannik
>> 
>> On Dec 19, 2013, at 4:14 PM, Stephan Eggermont <stephan at stack.nl> wrote:
>> 
>>> Norbert wrote:
>>> >To send or receive a broadcast packet you need to put special options on the socket on the native side (setsockopt). You need to >look if the SO_BROADCAST option is mentioned anywhere. If not it won’t work without adding them. And for sending them you >need almost special privileges on the system. This is not a „user feature“. 
>>> 
>>> And even though it is "the right thing" for lots of situations, your network is also very likely to not do the right thing
>>> with broadcast packets. Etsy decided on using bittorrent protocol to update their production servers indexes, because they
>>> found it too difficult to get their network to do the right thing. They found that their switches were basically livelocked
>>> while dealing with broadcast packets. 
>>> 
>>> http://codeascraft.com/2012/01/23/solr-bittorrent-index-replication/
>>> 
>>> If you want the broadcast to travel a little further, the routers need to be configured not to drop the packets.
>>> 
>>> Stephan
>> 
> 





More information about the Pharo-dev mailing list