Project

General

Profile

Bug #10788

Timeout not work with socket

Added by dashi6174 (邓 打师) about 4 years ago. Updated about 4 years ago.

Status:
Open
Priority:
Normal
Target version:
-
ruby -v:
ruby 2.0.0p481 (2014-05-08) [x64-mingw32]
[ruby-core:67840]

Description

Timeout.timeout(1) do
TCPSocket.new "33.2.2.1",333
end

The ip 33.2.2.1 is unreachable, I except it raise Timeout::Error, but
in fact it always raise Errno::ETIMEDOUT!

But I test it on Ubuntu14.04(ruby2.0), it's ok!

History

Updated by usa (Usaku NAKAMURA) about 4 years ago

Unfortunately, it's a restriction of WinSock.
You have to use Socket instead of TCPSocket and call Socket#connect_nonblock for your purpose.

Also available in: Atom PDF