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

Failed to Properly Format Select Statement #141

Open
topcheese opened this issue Aug 22, 2023 · 2 comments
Open

Failed to Properly Format Select Statement #141

topcheese opened this issue Aug 22, 2023 · 2 comments
Labels
Bug Something isn't working

Comments

@topcheese
Copy link

if select(
		(int(tcp_socket.socket)) + 1 &fd_read &fd_write &fd_errors &tv) == -1 {
    status.error_state = RmtError.rmt_error_socket_select_fail
    return status
}

Here's the original V code, I forgot the error, but it's a problem with the arguments. I'm just not sure how to rewrite it, but I should be able to figure it out. I'll jump on Discord if I can't get past it.
I believe the C code is below.

static SocketStatus TCPSocket_PollStatus(TCPSocket* tcp_socket)
{
    SocketStatus status;
    fd_set fd_read, fd_write, fd_errors;
    struct timeval tv;

    status.can_read = RMT_FALSE;
    status.can_write = RMT_FALSE;
    status.error_state = RMT_ERROR_NONE;

    assert(tcp_socket != NULL);
    if (tcp_socket->socket == INVALID_SOCKET)
    {
        status.error_state = RMT_ERROR_SOCKET_INVALID_POLL;
        return status;
    }
@ArtemkaKun ArtemkaKun added the Bug Something isn't working label Aug 22, 2023
@ArtemkaKun
Copy link
Contributor

Can you provide a link to the full code of the lib you are trying to translate?

@topcheese
Copy link
Author

Sorry about that, I'll remember to post it next time. https://github.com/topcheese/v-remotery/blob/main/lib/Remotery.c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants