Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Date: Sat, 9 Dec 2000 13:47:25 -0500 (EST) From: Dave Johnson To: cygwin AT cygwin DOT com Subject: connect() returns wrong errno for non-blocking sockets Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII While porting an application to cygwin I've discovered the following bug: When calling connect on a non-blocking socket it returns -1 with errno set to EAGAIN not EINPROGRESS. In every UNIX OS I've tried this in EINPROGRESS is the correct errno for non-blocking connect() calls. This is with cygwin 1.1.4. Is this a known problem or how it was intended to be designed? A short example is below (note that error checking return codes is being done, but not shown in the example): int nonblock = 1; int s; struct sockaddr_in saddr; struct hostent *remotehost; /* to_ip is a char* with remote host */ /* to_port is a char* with remote port number */ /* create a TCP socket */ s = socket( AF_INET, SOCK_STREAM, 0); /* setup saddr */ remotehost = gethostbyname(to_ip); bzero ((char *) &saddr, sizeof (saddr)); saddr.sin_family = AF_INET; saddr.sin_port = htons(atoi(to_port)); memcpy(&saddr.sin_addr, *((struct in_addr **)remotehost->h_addr_list), sizeof(struct in_addr)); /* set non-blocking so connect wont block */ ioctl(s, FIONBIO, &nonblock); connect(s, (struct sockaddr *) &saddr, sizeof(saddr)); /* connect returns -1 and sets errno to EAGAIN */ /* then go onto a select driven loop waiting for s to become * writable for either success or failure */ -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com