I wish to use the same socket fd for both read and write operations. Lets say the "fd" is the one which I am working on then in that case
FD_SET(fd, &readfd);
FD_SET(fd,&writefd);
select(fd+1, &readfd, &writefd, 0,200):
will hold good or it will return me the error.
I think since writefd and readfd are different sets the same fd can be set in both the sets. Please correct me if I am wrong.
Can I do the same behavior in poll POLLIN and POLLOUT to same fd.
This is ok, and the proper way to monitor the same fd for both reading and writing. The last argument to select is a struct timeval though, not an integer.