Easy timeout for CFWriteStreamWrite / CFReadStreamWriter?

Working with is CFStreamCreatePairWithSocketToHostalways convenient:

CFStreamCreatePairWithSocketToHost(kCFAllocatorDefault,
        (CFStringRef) hostnameOrIp,
        aPort,
        &readStream,
        &writeStream);

since he will immediately deliver the goods to you (pipe r and w). Unfortunately, CFReadStreamReadand CFWriteStreamRead. Is there an easy way to set the timeout (e.g. with streamOption)? They work in a thread - and since there are several parallel parallels, you would like to avoid runloop / signals - since any other pending reads / writes should not be interrupted).

Thank,

Dw.

+3
source share
1 answer

CFReadStreamHasBytesAvailable, , -. , CFReadStreamRead . (CFReadStreamSetClient) (kCFStreamEventHasBytesAvailable ).

+1

Source: https://habr.com/ru/post/1785485/


All Articles