Shortening socket timeout using Timeout::timeout(n) does not seem to work for me

前端 未结 2 1598
孤城傲影
孤城傲影 2021-01-07 00:12

I found what I thought should work perfectly at https://stackoverflow.com/questions/517219?tab=oldest#tab-top but, it did not work for me.

I have Ruby 1.9.1 installe

2条回答
  •  天涯浪人
    2021-01-07 01:15

    This may be due to some inherent problems with Rubys Timeout library. You can achieve this by directly accessing the underlying socket library and setting timeouts on the Socket. This article covers this in some depth, although it assumes *nix so you may have some issues with Windows, I'm not sure how similar the socket implementations are.

提交回复
热议问题