ios - dispatch_io_read a socket will wait for more data if receiving data size is smaller than length -


hi using dispatch_io_read socket in swift 2 on xcode 7 beta3. looks read action hold there when expected receiving data size smaller length specified. example,

if

dispatch_io_read(channel!, 0, 1000, inputqueue!, myreadhandler)

and data server less 1000 bytes, myreadhandler never called.

to solve this, have read bytes 1 one, there better solution?

thanks.

this little late, has same problem apple's documentation shows that..

"the length parameter indicates number of bytes should read i/o channel. pass size_max keep reading until eof encountered (for channel created disk-based file happens when reading past end of physical file)."

so, using size_max read available data attached file descriptor.

unfortunately, seems not work due bug in swift 3 dispatchio.read().


Comments