Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wish] Windows socket support with wepoll #7

Open
skywind3000 opened this issue Apr 13, 2024 · 1 comment
Open

[wish] Windows socket support with wepoll #7

skywind3000 opened this issue Apr 13, 2024 · 1 comment

Comments

@skywind3000
Copy link

skywind3000 commented Apr 13, 2024

Want to try it on Windows, but it lacks network support.

Could you please provide an option to build with wepoll (https://github.com/piscisaureus/wepoll) ?
It is a fast epoll implementation for Windows and has exact same APIs of linux's epoll.

it is also as portable as neco itself (only require wepoll.h and wepoll.c).

Maybe it could be implemented as a plugin for neco, which is disabled by default, but can be enabled by defining
a macro:

#define NECO_HAS_WEPOLL  1

Another option is using a cross-platform select function, eg:

https://gist.github.com/skywind3000/6886b61898044b2d81962109e26dc63d

@tidwall
Copy link
Owner

tidwall commented Apr 15, 2024

Neco for Windows needs some love for sure.

The biggest issue is that neco_wait() is not supported on Windows. This function waits for a file descriptor to be readable or writeable.

For example, this works on linux.

size_t n;
do {
    neco_wait(fd, NECO_WAIT_READ);
    n = neco_read(fd);
} while(n == -1 && errno == EAGAIN);

Under the hood, neco_wait automatically adds the file descriptor to epoll and waits for the scheduler to wake it back up.

Ideally Windows should do the same thing. I looked into using I/O Competion Ports, but I haven't had the time to implement it.

I would consider other solution too, but I'm not a Windows expert.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants