delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/06/18/05:42:39

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
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: <002801c45518$808914e0$b90d72d9@lsp>
From: "Lev Pliner" <pliner AT sky DOT ru>
To: <cygwin AT cygwin DOT com>
Subject: Question about select function
Date: Fri, 18 Jun 2004 15:41:59 +0600
MIME-Version: 1.0
X-IsSubscribed: yes

Dear forum members!

I'm writing a multithreaded rpc program. The following is a part of my
program that causes a error:

  fd_set readfds;
  int size = getdtablesize ( );

  while ( 1 )
  {
    readfds = svc_fdset;

    switch ( select ( size, &readfds, NULL, NULL, NULL ) )
    {
      case -1:
        if ( errno == EINTR )
          continue;
        else ...
      break;
      case 0:
        continue;
      break;
    };
  };

"select" call here causes the following error: "Bad file descriptor". This
example was taken from "Power programming with RPC" by John Bloomer.

I tried to understand what svc_fdset consits of:
sizeof ( svc_fdset ) == 2

Thus fd_set.fd_bits array has two elements:
sprintf ( "%ld %ld\n", svc_fdset.fds_bits [ 0 ], svc_fdset.fds_bits [ 1 ] )
== "8 0"

But somehow:
for (i=0;i<64;i++) FD_SET (i, svc_fdset) == 1

Could anyone tell me how to solve this problem?

Lev.


--
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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019