I think the following code does polling :
>> [ result := socket receiveUDPDataInto: buffer.
>>   result first > 0 ] whileFalse: [ (Delay forMilliseconds: 10) wait ].

and it is preferable to use semaphores, which are more efficient.
Is it possible to replace it by :

socket waitForData.
result :- socket receiveUDPDataInto: buffer  ???

Annick

PS : I have successfully used broadcast UDP on Raspberry

Le 21 oct. 2014 à 16:08, Henrik Johansen <henrik.s.johan...@veloxit.no> a écrit 
:

> 
>> On 21 Oct 2014, at 3:52 , Luc Fabresse <luc.fabre...@gmail.com> wrote:
>> 
>> 
>> 
>> 2014-10-21 15:40 GMT+02:00 Sven Van Caekenberghe <s...@stfx.eu>:
>> 
>> > On 21 Oct 2014, at 15:29, Luc Fabresse <luc.fabre...@gmail.com> wrote:
>> >
>> >
>> > yes examples are good.
>> > but I also suggest to use a stream on a UDPSocket instead of manipulating 
>> > the socket directly in the model code.
>> > Usually, it lowers the code complexity.
>> 
>> Hmm, are you sure that is even possible with UDP sockets ?
>> 
>> I was thinking of using a stream on the data part of the datagram packets.
>> If you have structured data it simpler to use #next or #nextImage, ...
>> 
>> And if the data part is bigger than one datagram packet (65535 IIRC), you 
>> can append to the stream as soon as you receive the next packet.
>> 
>> Does it sounds good?
>> 
>> Cheers,
>> 
>> Luc
> 
> UDP delivery isn't ordered, nor reliable.
> Build those into a Stream wrapper in order to reliably reconstruct a data 
> stream from the sender, and you're almost back to TCP...
> 
> Cheers,
> Henry

Reply via email to