add support for socket timeout