[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-atm
Subject:    Re: Anyone using select() successfully?
From:       "James R. Leu" <jleu () mindspring ! com>
Date:       2001-01-24 23:31:24
[Download RAW message or body]

>   while(1)
>   {
>     tv.tv_sec=5;
>     tv.tv_usec=0;
>     FD_ZERO( &server );
>     FD_SET( sock, &server );
> 
>     if( (res = select( 2, &server, NULL, NULL, &tv )) < 0 )

I know this might be trival, but is 2 greater then sock?

I would do:

      if( (res = select( sock + 1, &server, NULL, NULL, &tv )) < 0 )

just to make sure.


>     {
>       perror("Waiting for size notification");
>       return -1;
>     }
>     else if( res == 0 )
>     {
>       fprintf(stderr, "Wl");fflush(stderr);
>     }
>     else
>       break;
>   }
> 
> PS. I'm opening the socket as a stdio stream with fdopen (We've found
> that these higher level functions are more likely to work, oddly enough.
> Does it make any difference whether I open them with mode r+ or w+. I
> need to read/write to them.
> 
> ------------------------------------------------
> Cameron Kerr         email: ckerr@cs.otago.ac.nz 
> Computer Science Department, University of Otago 
> ------------------------------------------------

-- 
James R. Leu

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic