# How to wait on multiple file descriptors/streams

**URL:** <https://discourse.julialang.org/t/how-to-wait-on-multiple-file-descriptors-streams/46827>\
**Category:** General Usage\
**Tags:** input-output, sockets, filesystem\
**Created:** [September 18, 2020, 7:42am UTC](https://discourse.julialang.org/t/how-to-wait-on-multiple-file-descriptors-streams/46827 "2020-09-18T07:42:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![HanD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hand/32/213908_2.png) [@HanD](https://discourse.julialang.org/u/HanD)\
**Post date:** [September 18, 2020, 7:42am UTC](https://discourse.julialang.org/t/how-to-wait-on-multiple-file-descriptors-streams/46827/1 "2020-09-18T07:42:41Z")

</div>

Hello all,

I’m trying to read from multiple sockets/file descriptors, and would like to wait for either of them to have available bytes, then read them, and go back to waiting. In a regular posix system, I would use `select`, or `(e)poll` to determine which descriptor has data, but it seems that Julia doesn’t have a utility function to do that.

I tried using tasks to read from all sockets in asnyc threads, but not surprisingly, the read does not yield, but blocks the process instead. I would very much like to avoid an inifinite loop in which I poll the sockets with timeout values, that would be very inelegant.

I also tried searching the community discussions and the web in general for a solution, but nothing appropriate came up. Any ideas or hints?
