Advertisement

select() problem

Started by September 21, 2002 05:30 PM
2 comments, last by _Josh 22 years, 4 months ago
I'm having problems trying to use the select() command to check a socket. When I try to compile with gcc I get the following error: In Function 'nl_checkread': storage size of 'fds' isn't known I thought it might have something to do with FD_SETSIZE but I don't see any problems with it (and I haven't modified the headers). I'm using SuSE 8.0 if that makes any difference.


#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/time.h>
#include "netlib.h"


int nl_checkread(int sock)
{
	struct fd_set fds;
	struct timeval tv = {0, 0};
	int retval;


	fds.fd_count = 1;
	fds.fd_array[0] = sock;
	retval = select(0, &fds, NULL, NULL, &tv);
	if (retval < 0)
	{
		//error
		return(-1);
	}


	//success
	return(retval);
}

  
[edited by - _josh on September 21, 2002 6:31:26 PM]
I think it''s just ''fd_set'' (as opposed to ''struct fd_set''). I don''t think that fd_set has any members that you''re meant to access though (that''s what FD_SET and such are for).

Advertisement
use the macros like FD_SET,

see ''man select'' for more information
that did it

This topic is closed to new replies.

Advertisement