-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
NotImplementedError of Socket in Win32 #13328
Comments
Related: #13326 |
I reopen this issue duo to failed attempts with the probably new version to come. ERROR - http.server: Error while connecting a new socket
setsockopt: invalid argument (Socket::Error)
from A:\Scoop\apps\crystal\current\src\socket.cr:60 in 'initialize'
from A:\Scoop\apps\crystal\current\src\socket\tcp_server.cr:112 in 'accept?'
from A:\Scoop\apps\crystal\current\src\http\server.cr:467 in '->'
from A:\Scoop\apps\crystal\current\src\fiber.cr:146 in 'run' |
Similar to #9065, but only occurs on Windows in my use case. |
Do you have a minimal reproducible example? |
require "http/server"
server = HTTP::Server.new do |context|
case context.request.method
when "GET"
case context.request.path
when "/time"
time(context)
else
context.response.status = HTTP::Status::NOT_FOUND
context.response.puts "Cannot #{context.request.method} #{context.request.path}"
end
else
context.response.status = HTTP::Status::METHOD_NOT_ALLOWED
context.response.puts "#{context.request.method} method is not supported"
end
end
def time(context)
time = Time.utc(1, 1, 1)
context.response.puts time.to_s("%F")
end
address = server.bind_tcp "0.0.0.0", 80, true
puts "Listening on http://" + address.to_s
server.listen
On Windows
On Alpine with Crystal 1.8.2, it returns as expected
|
Also, with reuse_port set false, it works quite well.
It's |
From what I could gather, if |
Yeah my bad, they are exclusive settings - I didn't pay enough attention to the initialization flow. So your pull request looks good to me |
It seems that Socket for win32 has been implemented. #10784
Compiling projects built with grip or kemal has no more problems other than the wrong newline character of the exception_page.ecr file. #13304
However, when I run it, NotImplementedError of Socket#reuse_port occurs.
Crystal - 1.8.0
The text was updated successfully, but these errors were encountered: