Add timeout for socket