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
Crystal 0.20 Error while spawning 2 HTTP::Server on the same port - SO_REUSEADDRESS #3586
Comments
There is a misunderstanding in how |
Thx, I read it |
@ysbaddaden is it possible to use |
@Sija @ysbaddaden I've compiled crystal with SO_REUSEPORT on Linux x64, works great, but not tested on other platforms |
@Sija there is no limitation to use it, as long as you can set the option, which I'm unsure with the current Crystal API. BTW, if I recall correctly, we do set |
@ysbaddaden @bcardiff perhaps we can introduce |
If someone want to test on other platform :
And this : def reuse_port?
getsockopt_bool LibC::SO_REUSEPORT
end
def reuse_port=(val : Bool)
setsockopt_bool LibC::SO_REUSEPORT, val
end in class Socket in socket.cr I used this to benchmark Crystal with multithreading NodeJS vs Crystal vs Golang |
I'm trying to make a multithreaded/forked http server, but I can't set reuse_address, and it should be true by default.
Code :
Error :
in crystal/src/socket/tcp_server.cr :
The text was updated successfully, but these errors were encountered: