Hi,
What's worng here. My select() call always return 0. Here my parent is the server and child is the client. My select() call is in the server process.
Code:
while (1) {
    printf("----------Inside select()\n");
    sel = select(sockfd, &read_fd, NULL, NULL, &timeout);
    FD_SET(sockfd, &read_fd);
    if (sel > 0) {
        if (FD_ISSET(sockfd, &read_fd)) {
            clilen = sizeof(clientAdd);
            if ( (newsockfd = accept(sockfd, (struct sockaddr *)&clientAdd, &clilen) < 0)){
                printf("ERROR SERVER: Accept() failed\n");
                exit(1);
            }
            //make child process
            printf("forking now\n");
            pid = fork();
            if (pid < 0) {
                perror("fork");
                exit(1);
            }
            if (pid == 0) { //child process

                printf("this is the child\n");
                // The sockfd has data to be read
                close(sockfd);
                n = read(newsockfd, buffer, 255);
                printf("received size: %d\n", n);
                printf("%s\n", buffer);
                close(newsockfd);
            } else {        //parent process
                printf("This is the parents\n");
                close(newsockfd);
            }
            } else {
                printf("FD_ISSET() did not set\n");
            }
        }else if (sel < 0) {
            /* An error ocurred, just print it to stdout */
            perror("select");
        } else if (sel == 0) {
            printf("select is returnig 0\n\n");
            break;
        }
    }