> On 24 May 2018, at 19:28, Hilaire <[email protected]> wrote: > > Hi, > > With this code, the ConnectionTimedOut exception is never handled: > > | socket data | > socket := Socket newUDP. > socket setPort: 51284. > socket waitForDataFor: 5. > data := ByteArray new: 100. > [[socket receiveUDPDataInto: data] > on: Error > do: ['Catched error, closing socket' crLog. socket closeAndDestroy]] > ensure: [ 'Closing socket' crLog. socket closeAndDestroy] > > Any reason it does not work? > > In Pharo I see several examples using ifCurtailed. > > Hilaire > > -- > Dr. Geo > http://drgeo.eu
#receiveUDPDataInto: returns immediately, possibly with zero bytes read. It is #waitForDataFor: that signals the ConnectionTimedOut. Move that expression into the inner block. Sven
