Is there a plain C socket library for Windows, but with a simpler API, which uses IOCP under the hood?

I have some legacy C code which I'd like to replace with IOCP, but I would also like to avoid writing the whole thing from scratch, managing buffers, threads, concurrency and all the baggage.

Ideally, it would expose a simpler API which would allow the user to attach a couple of callbacks and forget about it, ideally something like:

// call onAccept whenever a new client connects 
callbacks = { .accept = onAccept };
start_listening(TCP, "", 4200, callbacks);

// call onReceive/onSend when operation finishes
callbacks = { .recv = onReceive, .send = onSend, .close = onClose };
register_callbacks(new_socket, callbacks);

// begin async operation

I've been able to find mostly C++ libraries, but C sources are mostly examples similar to MSDN, without an actual API.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.