From owner-freebsd-questions@FreeBSD.ORG Tue Aug 1 21:21:49 2006 Return-Path: X-Original-To: questions@freebsd.org Delivered-To: freebsd-questions@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3B6F516A4DA for ; Tue, 1 Aug 2006 21:21:49 +0000 (UTC) (envelope-from dan@dan.emsphone.com) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by mx1.FreeBSD.org (Postfix) with ESMTP id BC18B43D55 for ; Tue, 1 Aug 2006 21:21:48 +0000 (GMT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.13.1/8.13.4) id k71LLi6h021210; Tue, 1 Aug 2006 16:21:44 -0500 (CDT) (envelope-from dan) Date: Tue, 1 Aug 2006 16:21:44 -0500 From: Dan Nelson To: Bill Moran Message-ID: <20060801212144.GH63872@dan.emsphone.com> References: <20060801150226.0c911297.wmoran@collaborativefusion.com> <000401c6b59e$92d942d0$3c01a8c0@coolf89ea26645> <20060801152107.eba203fa.wmoran@collaborativefusion.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060801152107.eba203fa.wmoran@collaborativefusion.com> X-OS: FreeBSD 5.5-PRERELEASE X-message-flag: Outlook Error User-Agent: Mutt/1.5.12-2006-07-14 Cc: questions@freebsd.org Subject: Re: Reducing the timeout on a TCP connection X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Aug 2006 21:21:49 -0000 In the last episode (Aug 01), Bill Moran said: > In response to "Ted Mittelstaedt" : > > This is why the snmp protocol uses UDP, Bill. > > > > You need to use something other than TCP for > > monitoring. > > Well ... if I'm monitoring a server that uses TCP (PostgreSQL) I > can't rightly establish whether or not it's successfully accepting > connections unless I used TCP as well. What I do is ping the target server first, with a small (1s) timeout. If the ping fails, I don't try the TCP socket. If the ping succeeds, I know the TCP connection will either complete or fail immediately. Another option is to do non-blocking connects to as many servers as you have fds available, and select()/poll()/kqueue() for the results. that way at least you're checking other machines while waiting for the few dead ones. -- Dan Nelson dnelson@allantgroup.com