Using IO.select for socket read timeout, using STD timeout for connection timeout, problems seem fixed