We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
As known to all. int bind(...) is an immediately completion function.
int bind(...)
int bind(int sockfd, const struct sockaddr *addr, socklen_t addrlen);
bind is not an async function but luasocket stupidly make it async
bind
async
But luasocket needs set timeout(n) n > 0 to finish a simple bind.
Why do a bind need so much seconds?
And also tcp.listen is also an immediately completion function:
tcp.listen
int listen(int sockfd, int backlog);
You just:
if (listen(&fd, 100) == -1)
to check the result immediately.
What does luasocket timeout for?
luasocket
I GUESS the reason why luasocket is always failed coz using a stupid Thread way to do a dead easy bind:
void socked_bind() { auto ret = std::thread([]{ return bind(fd, ...); }) return ret }
So the Lua side set timeout(0) means not to wait this thread and use the ret as result. And not doing Thread.join(ret).
ret
So the bind procedure is released and failed.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
As known to all.
int bind(...)
is an immediately completion function.int bind(int sockfd, const struct sockaddr *addr, socklen_t addrlen);
bind
is not an async function but luasocket stupidly make itasync
But luasocket needs set timeout(n) n > 0 to finish a simple
bind
.Why do a
bind
need so much seconds?And also
tcp.listen
is also an immediately completion function:int listen(int sockfd, int backlog);
You just:
to check the result immediately.
What does
luasocket
timeout for?I GUESS the reason why
luasocket
is always failed coz using a stupid Thread way to do a dead easybind
:So the Lua side set timeout(0) means not to wait this thread and use the
ret
as result. And not doing Thread.join(ret).So the
bind
procedure is released and failed.The text was updated successfully, but these errors were encountered: