The next code, suppost to wait until a data is been sent to me, and
then I place it in the in_msg variable.
*The sockfd is the Socket Descriptor!

<code>
int Wait(int sockfd)
{
char in_msg[100]={0};
int num_bytes;
fd_set read_fd;

FD_ZERO(&read_fd);
FD_SET(sockfd, &read_fd);
if (select(sockfd+1, &read_fd, NULL, NULL, NULL)==-1) {
return(0); // error
}
if (FD_ISSET(sockfd, &read_fd))
{
if ((num_bytes=recv(sockfd, in_msg, 100, 0))==-1)
return(0); // error
if (!num_bytes)
return(0); // error
if (strcmp("Okay", in_msg)==0)
return(1); // success
}
return(0); no matter what, he get here, why???
}
</code>

Now the question is, will this code place the recieved data in
in_msg variable?

thanks.