using socket with timeout option