UDP sendto/recvfrom error

Tracy Xiaodi Lu (xlu@exodus.net)
Tue, 13 Jul 1999 10:56:58 -0700


Hi,
I hope someone can help to tell me why I met this error.
------------------OK---------------
int client_len;
int n=0;
while(1)
{
if (n=recvfrom(sockfd,buffer,size,0,pclient_addr,&client_len))<=0)
printf("error");
sendto(.....)
}
------------------ recvfrom error-----------
int n=0;
int client_len;
while(1)
{
if (n=recvfrom(sockfd,buffer,size,0,pclient_addr,&client_len))<=0)
printf("error");
sendto(.....)
}
------------------

I found if I declare the int client_len right before the while loop, the
recvfrom fucntion will return the "Invalid Argument" (22) error. But it
works fine if I declare one of more variable after client_len.

Thanks! I appreciate your help.

Tracy

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/