Launch each socket into it's own task (@async) and let Julia's green-threading manage the poll/select for you internally.
On Friday, May 13, 2016 at 8:08:01 PM UTC-4, Andrei Zh wrote: > > 1. I found out that TCPSocket contains several conditions and callbacks, > but I couldn't find any docs or example of their usage. > 2. I also found #6563 <https://github.com/JuliaLang/julia/issues/6563> that > discusses exactly the problem of listening to multiple conditions / > channels. > > So if I manage to create a callback for incoming data, I will be able to > borrow some ideas from (1) and come up with a `select` function that > satisfies my needs. Does anybody have an example of using TCPSocket's > callbacks/conditions? > > On Thursday, May 12, 2016 at 12:45:44 AM UTC+3, Andrei Zh wrote: >> >> Given several TCPSocket-s, how can I sequentially poll them and read the >> first that becomes readable? >> >> I believe *nix's poll/select functions provide something similar for >> files (and Julia has `poll_fd`), but what is the best way to approach this >> task for sockets? >> >
