From: usa@... Date: 2015-01-27T16:23:29+00:00 Subject: [ruby-core:67843] [ruby-trunk - Bug #10788] Timeout not work with socket Issue #10788 has been updated by Usaku NAKAMURA. Unfortunately, it's a restriction of WinSock. You have to use Socket instead of TCPSocket and call Socket#connect_nonblock for your purpose. ---------------------------------------- Bug #10788: Timeout not work with socket https://bugs.ruby-lang.org/issues/10788#change-51252 * Author: ��� ������ * Status: Open * Priority: Normal * Assignee: Usaku NAKAMURA * ruby -v: ruby 2.0.0p481 (2014-05-08) [x64-mingw32] * Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN ---------------------------------------- `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! -- https://bugs.ruby-lang.org/