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 Date: Wed, 19 Mar 2003 20:46:39 -0500 From: Christopher Faylor To: cygwin AT cygwin DOT com Subject: Re: strange bug : select() always generate 10022 error Message-ID: <20030320014639.GH32580@redhat.com> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <7909C3E22B10FA4DB1BD49A747D54FFD0EC3DA AT DYN-EXCH-001 DOT dynamicsoft DOT com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7909C3E22B10FA4DB1BD49A747D54FFD0EC3DA@DYN-EXCH-001.dynamicsoft.com> User-Agent: Mutt/1.5.1i On Wed, Mar 19, 2003 at 03:33:24PM -0500, Sean Tang wrote: >In the folowing code : >If I include before and , select() always >generate 10022 error. >If I include after and , select() works >OK. It sounds like you're mixing cygwin's select with winsock select. "You can't do that". Get rid of all the winsock and windows stuff and just treat this like a standard unix program. cgf TCM >#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/ -- 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/