dicom / ruby-dicom

Library for reading, editing and writing DICOM files, as well as handling DICOM network communication. Written in the Ruby language.
http://dicom.rubyforge.org/
GNU General Public License v3.0
178 stars 67 forks source link

Best way to setup a timeout on tcp connection? #79

Open aamazigh opened 3 years ago

aamazigh commented 3 years ago

How would you set a timeout on a tcp connection when echoing a server?

The echo method uses TCPSocket, which, as far as I know, doesn't have a timeout.

https://github.com/dicom/ruby-dicom/blob/204ddedf070eaf3819bb1b269bb9f8681c789bb9/lib/dicom/link.rb#L1118

Thank you in advance.

Best regards,

Amazigh

dicom commented 3 years ago

Hi Amazigh

Thanks for raising the question.

Its been a while since this was fresh to me, I'll have to admit.

Please have a look at this to see if it helps you out: https://stackoverflow.com/questions/21014272/how-is-ruby-tcpsocket-timeout-defined

Best regards, Christoffer