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
uv_open #200
Comments
Ok, after further investigation, the signatures are a bit different: UV_EXTERN int uv_udp_open(uv_udp_t* handle, uv_os_sock_t sock);
UV_EXTERN int uv_tcp_open(uv_tcp_t* handle, uv_os_sock_t sock);
UV_EXTERN int uv_pipe_open(uv_pipe_t*, uv_file file); On windows uv_os_sock_t is SOCKET. Don't know what to make of it. |
This would indeed be nice, specially on Unix, there everything is a fd. On Windows, however, we have a problem, which I don't know how to solve elegantly. AFAIK all SOCKET and HANDLEs can be stored as 32bit integers, because even on 64bit Windows, handles only use the lest signifficant 32bits, but it sounds too much like a hack. |
We could use IntPtr and cast to Int on unix only. |
That's just reversing the hack :-S |
But there is no possible way we loose precision that way |
I still think we're trying to force it here. Not to mention While I like the idea, I don't like how the implementation would result, so lets stick with the different functions we have for now. |
I agree, this is the way C libs work |
Removed superfluous scope.
I was looking into the code and one thing stood out in my eyes: we have functions like uv_write and uv_fileno which basically accept any kind of handle and dependent on the type of it (which is a basically a variable in the struct) it determines what to do.
Yet we have multiple functions for opening an already existing file descriptor: uv_tcp_open, uv_udp_open.
The most annoying part IMO is that there is no uv_tty_open, even though the constructor of uv_tty_init requires a file descriptor. I think we could move the functionality of opening a file descriptor in a tty to open.
I think creating uv_open would make writing bindings easier, because currently it kinda is a lot of code.
The text was updated successfully, but these errors were encountered: