I get the warning: passing argument 2 of 'accept' from incompatible pointer type [-Wincompatible-pointer-types]
Why am I getting this error?
if(s = accept(ls, &client_address, &client_address_len)<0);
{
perror("Error: accepting failed!!");
exit(1);
}
According to https://pubs.opengroup.org/onlinepubs/009695399/functions/accept.html , the second argument of accept
function receives a type of struct sockaddr *
. You might want to do a conversion: &client_address
to (struct sockaddr *)&client_address
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.