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: <7909C3E22B10FA4DB1BD49A747D54FFD0EC3DA@DYN-EXCH-001.dynamicsoft.com> From: Sean Tang To: "'cygwin AT cygwin DOT com'" Subject: strange bug : select() always generate 10022 error Date: Wed, 19 Mar 2003 15:33:24 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" In the folowing code : If I include before and , select() always generate 10022 error. If I include after and , select() works OK. #include #include #define USE_SYS_TYPES_FD_SET #include int main(int argc, char *argv[]) { WORD wVersionRequested; WSADATA wsaData; int err; wVersionRequested = MAKEWORD( 2, 2 ); err = WSAStartup( wVersionRequested, &wsaData ); if ( err != 0 ) { printf("we could not find a usable WinSock DLL\n"); return -1; } if ( LOBYTE( wsaData.wVersion ) != 2 || HIBYTE( wsaData.wVersion ) != 2 ) { printf("we could not find a usable WinSock DLL\n"); WSACleanup( ); return -1; } fd_set fds; int s= socket(AF_INET, SOCK_STREAM, 0); FD_ZERO(&fds); FD_SET((unsigned)s, &fds); if( select(s+1, &fds, NULL, NULL, 0) == -1 ) { printf("socket error : %d\n", WSAGetLastError()); return -1; } return 0; } -- 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/