Mail Archives: cygwin/2004/06/25/05:41:23
#include <stdio.h>
#include <sys/errno.h>
#include <rpc/rpc.h>
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/
- Raw text -