Hi Esteban,
On Sat, 16 Mar 2019 at 19:37, Esteban Maringolo <[email protected]> wrote:
>
> I don't know the answer but how could you peek for data that has yet not come 
> through the socket? In the buffer? Should it block?

>From memory: It depends on the mode of the stream:

If synchronous: peeking will block until data is available.
If asynchronous: if data is available, the next byte / character is
returned.  If no data is available, nil is returned.  If nil is
returned, you need to check if the socked is #atEnd to determine
whether it is the end of the stream or just nothing available now.

Cheers,
Alistair



> Regards.
>
> El sáb., 16 de mar. de 2019 12:23, Alistair Grant <[email protected]> 
> escribió:
>>
>> Hi Sven,
>>
>> Unlike most streams that support #peek, ZdcAbstractSocketStream
>> doesn't support #peekFor:.
>>
>> Is this intentional, or an oversight?
>>
>> Thanks,
>> Alistair
>>

Reply via email to