How do I use Socket.select?
Mike Parker
aldacron at gmail.com
Mon Nov 13 02:42:11 UTC 2017
On Sunday, 12 November 2017 at 21:45:56 UTC, Anonymouse wrote:
>
> But a "status change" for a reading Socket is "stuff can now
> connect", for a writing one "connection established", and not
> sure about the error ones. It doesn't seem to be "there's data
> waiting to be read" which I'd hoped for, since my program (IRC
> bot) in essence connects once and stays such throughout its
> life.
>
> What else is there to select that I'm missing? Or is it mostly
> a thing for programs with lots of Sockets, lots of connections?
The read set is used to determine if a socket has data waiting to
read. It just happens that with a listening socket, that means
there's a new connection. With a normal socket, it means data
packets are ready. Maybe you should take a look at the classic
Beej's guide, which covers the C API. Should be easy to translate
to the std.socket API.
http://beej.us/guide/bgnet/
More information about the Digitalmars-d-learn
mailing list