Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-ID: <031501c2dc32$8d430390$c67486d9@webdev> From: "Elfyn McBratney" To: "cygwin" , "Eric Mandel" References: <200302241757 DOT h1OHvQN16044 AT head-cfa DOT cfa DOT harvard DOT edu> Subject: Re: connect() not interrupted by sigalrm? Date: Mon, 24 Feb 2003 18:28:33 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 > I have an application that calls alarm() before connect() in order to > prevent connect() from hanging if the host is down or non-existent. > When alarm() goes off, it sends the SIGALRM signal, which interrupts > the connect() system call. This works under Linux, Solaris, OSF, and > Mac OS X, but apparently not under Cygwin. As shown in the appended > code, the alarm does go off and can trigger an associated alarm > function, but the connect() system call is not interrupted. Cockpit error. You left out a few headers. --- connect_test.c.orig 2003-02-24 18:25:34.000000000 +0000 +++ connect_test.c 2003-02-24 18:18:42.000000000 +0000 @@ -7,8 +7,11 @@ #include #include +#include #include #include #include #include +#include +#include /* the domain exists but not the machine */ - string.h is needed for memset() - unistd.h is needed for alarm() - arpa/inet.h is needed for inet_addr() After that it works fine. Regards, Elfyn McBratney elfyn AT exposure DOT org DOT uk www.exposure.org.uk -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/