{ debug_msg("%d receiving\n", getpid()); nbytes = recvfrom( s, buf,sizeof(buf)-1,0, (struct sockaddr *)&client,&clientlen); debug_msg("%d received %d bytes (%s) from %s\n", getpid(), nbytes, buf, inet_ntoa(client.sin_addr)); write(fd,"OK ",6); FD_SET(sockfd, &mask); if (sockfd > maxfd) maxfd = sockfd; FD_CLR(s, &rmask); if ( -1 == shutdown(sockfd,2)) perror("shutdown"); else debug_msg("- %d: shutdown\n",fd); if ( -1 == close(sockfd)) perror("close"); else debug_msg("- %d: closed\n", fd); }