async socket programming in D?

Etienne Cimon via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Apr 20 21:32:19 PDT 2014


On 2014-04-20 18:44, Bauss wrote:
> I know the socket has the nonblocking settings, but how would I actually
> go around using it in D? Is there a specific procedure for it to work
> correctly etc.
>
>
> I've taken a look at splat.d but it seems to be very outdated, so that's
> why I went ahead and asked here as I'd probably have to end up writing
> my own wrapper.

I was actually working on this in a new event loop for vibe.d here: 
https://github.com/globecsys/vibe.d/tree/native-events/source/vibe/core/events

I've left it without activity for a week b/c I'm currently busy making a 
(closed source) SSL library to replace openSSL in my projects, but I'll 
return to this one project here within a couple weeks at most.

It doesn't build yet, but you can probably use some of it at least as a 
reference, it took me a while to harvest the info on windows and linux 
kernels for async I/O. Some interesting parts like that which you wanted 
are found here:
https://github.com/globecsys/vibe.d/blob/native-events/source/vibe/core/events/epoll.d#L403

I think I was at handling a new connection or incoming data though, so 
you won't find accept() or read callbacks, but with it I think it was 
pretty much ready for async TCP.


More information about the Digitalmars-d-learn mailing list