Prasad Chemburkar wrote:
> I am writing a proxy server in 'C' using sockets.i have already written a
> socket program to bind connection for specified port. I have to use
> select system call to check the value of file descriptors for writing &
> reading the value to sockets. i dont no how to pass a descriptor value of
> defined socket to select system call since select call uses descriptor
> values. can anyone please help me.
You have to use the FD_* macros to create descriptor sets. If you want
to wait for a descriptor `fd' to become readable, you would use
something like:
int wait_for_read(int fd)
{
fd_set fds;
FD_ZERO(&fds);
FD_SET(fd, &fds);
if (select(fd + 1, &fds, NULL, NULL, NULL) < 0)
{
perror("select");
return 0;
}
return FD_ISSET(fd, &fds);
}
--
Glynn Clements <[EMAIL PROTECTED]>