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: <006a01c45a98$7cdb4450$b90d72d9@lsp> From: "Lev Pliner" To: "Lev Pliner" , References: <001301c45a98$089c0cf0$b90d72d9 AT lsp> Subject: Re: Question about select function [code of probe.c] Date: Fri, 25 Jun 2004 15:40:44 +0600 MIME-Version: 1.0 Content-Type: text/plain; charset="koi8-r" Content-Transfer-Encoding: 7bit X-IsSubscribed: yes #include #include #include void probe ( rqstp, transp ) struct svc_req *rqstp; SVCXPRT *transp; { switch ( rqstp->rq_proc ) { case NULLPROC: svc_sendreply ( transp, xdr_void, (void *)NULL ); return; default: svcerr_noproc ( transp ); return; }; }; int main ( argc, argv ) int argc; char *argv[]; { SVCXPRT *transp = NULL; fd_set readfds; int size = getdtablesize ( ); if ( ( transp = svctcp_create ( RPC_ANYSOCK, 0, 0 ) ) == NULL ) { perror ( "1" ); exit ( 1 ); }; svc_unregister ( 0x2A000001, 1 ); if ( !svc_register ( transp, 0x2A000001, 1, probe, IPPROTO_TCP ) ) { perror ( "2" ); exit ( 1 ); }; if ( argc > 1 ) while ( 1 ) { readfds = svc_fdset; switch ( select ( size, &readfds, NULL, NULL, NULL ) ) { case -1: if ( errno == EINTR ) continue; else { perror ( "3" ); exit ( 1 ); }; break; case 0: continue; break; default: if ( !bcmp ( &readfds, &svc_fdset, sizeof ( fd_set ) ) ) continue; svc_getreqset ( transp ); break; }; } else svc_run ( ); exit ( 0 ); }; -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/