Gordon Messmer wrote:
Howard Wilkinson wrote:Can you suggest such a list - I can only find lists for POSIX threads! Code goes as follows I contend that this should (if I understand the semantics correctly) print out "Socket not ready to read" instead I get "recv - Resource temporarily unavailable(11)"int fd[2] = { -1, -1 }; fd_set rfd; int rv; char buf[1024]; struct timeval timeout = { 10, 0 }; rv = socketpair(PF_UNIX, SOCK_DGRAM, 0, fd); if (rv < 0) Err("socketpair"); fcntl(fd[0], F_SETFL, fcntl(fd[0], F_GETFL, 0) | O_NONBLOCK); FD_ZERO(rfd); FD_SET(fd[0], rfd); rv = select(fd[0]+1, &rfd, NULL, NULL, &timeout); if (FD_ISSET(fd[0], rfd)) { printf("Socket is ready to read\n"); rv = recv(fd[0], buf, sizeof(buf), MSG_DONTWAIT); if (rv < 0) Err("recv - %s(%d)", strerror(errno), errno); printf("Socket returned %d bytes\n", rv); } else { printf("Socket is not ready to read\n"); } exit (0); Anybody? |
-- fedora-list mailing list fedora-list@xxxxxxxxxx To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list